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;

    @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) : [email protected]37b2<[email protected]>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : [email protected]2b5b<[email protected]>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : [email protected]60ce<[email protected]>
2019-06-11 21:30:16.860  WARN 33728 --- [nio-8888-exec-1] o.h.e.loading.internal.LoadContexts      : HHH000100: Fail-safe cleanup (collections) : [email protected]d7b1<[email protected]>
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方法,就可以了

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

时间: 2024-08-30 18:12:14

vue - blog开发学习6的相关文章

vue - blog开发学习1

1.安装vue-cli vue intall -g vue-cli 2.创建项目 vue init webpack nblog 3.按提示要求配置项目 ? Project name nblog ? Project description 学习bolg开发 ? Author nxzJIA <987097855@qq.com> ? Vue build standalone ? Install vue-router? Yes ? Use ESLint to lint your code? Yes ?

vue - blog开发学习2

首页博客列表的开发 1.修改index.vue,使能够支持列表功能 <template> <div> <PostList v-for="(item,index) in postList" :title="item.title" :content="item.content" :postCount="postCount" :key="index"></PostList

vue - blog开发学习5

基本功能和后台联调 1.首页的所有博客 因为是前后台都是本地开发,所以前端vue需要设置proxy:修改/config/index.js中的这个proxyTable proxyTable: { '/api': { target: 'http://localhost:8888', changeOrigin: true, pathRewrite: { '^/api': '' } }, 同时将mock.js中的模拟数据方法注释掉 2.后台添加cors package com.nxz.blog.conf

web前端开发学习课程大纲路线图及学习方法分享

想学好web前端开发,要学会阅读别人优秀的代码.web前端开发思想并不是统一固定不变的,阅读别人代码的过程就是间接的在向别人学习,这一过程中可以学习别人的开发思路,不同的人思路是不一样的,如果别人写的代码很优秀.很简单.且运行和性能上有很大的优势,就有很多可以借鉴的地方. 以下这份web前端学习路线图适合所以零基础的学员学习,都是从浅入深,没有基础的同学跟着视频教程及课程大纲一步一步的学习是可以很好的掌握的. 那么想要学好html5前端开发,那么需要掌握的专业技术有: 第一阶段:前端页面重构 内

Android开发学习之路--网络编程之xml、json

一般网络数据通过http来get,post,那么其中的数据不可能杂乱无章,比如我要post一段数据,肯定是要有一定的格式,协议的.常用的就是xml和json了.在此先要搭建个简单的服务器吧,首先呢下载xampp,然后安装之类的就不再多讲了,参考http://cnbin.github.io/blog/2015/06/05/mac-an-zhuang-he-shi-yong-xampp/.安装好后,启动xampp,之后在浏览器输入localhost或者127.0.0.1就可以看到如下所示了: 这个就

Android开发学习---使用XmlPullParser解析xml文件

Android中解析XML的方式主要有三种:sax,dom和pull关于其内容可参考:http://blog.csdn.net/liuhe688/article/details/6415593 本文将主要介绍pull解析器解析xml文件,环境为ubuntu 12.04+ intelij 13.1 + android sdk 2.1 一.创建一个XML项目,步骤如下: 二.解析一个xml文件: assets/person.xml <?xml version="1.0" encodi

.net 网站开发学习资源

慕课网 前端基础学习 http://www.imooc.com/course/list?c=fe 了解需求 例子之一 http://wenku.it168.com/d_000517899.shtml mvc教程 http://blog.csdn.net/powertoolsteam/article/details/47609257 asp.net 的使用类大全 http://git.oschina.net/kuiyu/dotnetcodes/blob/master/DotNet.Utilitie

[Android游戏开发学习笔记]View和SurfaceView

本文为阅读http://blog.csdn.net/xiaominghimi/article/details/6089594的笔记. 在Android游戏中充当主要角色的,除了控制类就是显示类.而在Android中涉及到显示的是View类,及继承自它的SurfaceView类和SurfaceView的其他子类等. 这里先只说View和SurfaceView.SurfaceView的直接子类有GLSurfaceView和VideoView,可以看出GL和视频播放以及CAmera摄像头一般均使用Su

Vue.js 基础学习

今天我开始了Vue.js 的学习. 那么什么是Vue.js 呢? Vue.js是一套开发Web页面的JavaScript脚本框架.听起来感觉很难,不过据说,Vue.js是Web-Javascript脚本框架中最容易上手的框架.所以我便选择了先来学习这个. 要学习Vue.js首先就要获取库文件了,在网上有很多地方可以找到,我是在bootcdn上找到的 接下来我们通过Vue输出一串Hello World ! 首先引入vue. <script src="https://cdn.bootcss.c