vue - blog开发学习6
生活随笔
收集整理的這篇文章主要介紹了
vue - blog开发学习6
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
vue - blog開發學習6
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;@Lobprivate 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方法,就可以了
?
posted @ 2019-06-12 20:45 巡山小妖N 閱讀(...) 評論(...) 編輯 收藏總結
以上是生活随笔為你收集整理的vue - blog开发学习6的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: vue - blog开发学习5
- 下一篇: html5倒计时秒杀怎么做,vue 设