标签: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方法,就可以了
标签:tostring ota join map ons 出现 安装 pack coding
原文地址:https://www.cnblogs.com/nxzblogs/p/11012633.html