码迷,mamicode.com
首页 > 其他好文 > 详细

vue - blog开发学习6

时间:2019-06-12 21:39:14      阅读:133      评论:0      收藏:0      [点我收藏+]

标签:tostring   ota   join   map   ons   出现   安装   pack   coding   

1、问题,如下图,使用iviewui中的card导致页面不能出现滚动条(不太会弄,在网上查了一个vue组件vuescroll,因此使用这个做滚动条)

技术图片

2、安装vuescroll

 cnpm install -S vuescroll

https://vuescrolljs.yvescoding.org/zh/guide/getting-started.html#%E5%AE%89%E8%A3%85

3、问题:项目使用的jpa操作数据库,因为postclass和post是多堆多的关系,因此post.java和postclass.java如下,

package com.nxz.blog.entity;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Entity
@Data
public class Post {

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(length = 32)
    private String postId;

    private String postTitle;

    @Lob
    private String postContent;

    /**
     * 摘要,也就是content的前100个字符
     */
    private String postRemark;

    private Long createDate;

    private Long updateDate;

    @ManyToMany(fetch = FetchType.LAZY)
    @JoinTable(name = "post_postclass", joinColumns = {@JoinColumn(name = "post_id")}, inverseJoinColumns = {@JoinColumn(name = "post_class_id")})
    private Set<PostClass> postClasses = new HashSet<>();

}
package com.nxz.blog.entity;

import lombok.Data;
import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

@Entity
@Data
public class PostClass {

    @Id
    @GeneratedValue(generator = "system-uuid")
    @GenericGenerator(name = "system-uuid", strategy = "uuid")
    @Column(length = 32)
    private String classId;

    @Column(unique = true,length = 50)
    private String className;

    @ManyToMany(mappedBy = "postClasses", fetch = FetchType.LAZY)
    private Set<Post> posts = new HashSet<>();

}

但是当调用post.getPostclasses时会出错,会循环输出一下内容:

HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@15e337b2<rs=com.alibaba.druid.pool.DruidPooledResultSet@4ee3a800>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@6fcf2b5b<rs=com.alibaba.druid.pool.DruidPooledResultSet@2547c902>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@2a4c60ce<rs=com.alibaba.druid.pool.DruidPooledResultSet@21504902>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : org.hibernate.engine.loading.internal.CollectionLoadContext@7b7ad7b1<rs=com.alibaba.druid.pool.DruidPooledResultSet@6f290408>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : H

经过查询资料:https://stackoverflow.com/questions/54946083/jpa-bidirectional-mapping-not-fetching-deep-mapped-data

得知,这个应该是lombok注解@Data导致的,具体原因没有查明,把这个注解去掉,同时自己手写get、set方法和tostring方法,就可以了

 

vue - blog开发学习6

标签:tostring   ota   join   map   ons   出现   安装   pack   coding   

原文地址:https://www.cnblogs.com/nxzblogs/p/11012633.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!