其他分享
首页 > 其他分享> > Unable to evaluate the expression Method threw 'org.hibernate.LazyInitializationException'

Unable to evaluate the expression Method threw 'org.hibernate.LazyInitializationException'

作者:互联网

Unable to evaluate the expression Method threw 'org.hibernate.LazyInitializationException' exception.

错误

实体类当前字段关系为 OneToMany。

    @OneToMany(mappedBy = "userId")
    private Set<TtUserSignIn> signInIds = new HashSet<>();

在这里插入图片描述

解决方案

加入 fetch = FetchType.EAGER ,然后在运行不会报错了。

    @OneToMany(mappedBy = "userId",fetch = FetchType.EAGER)
    private Set<TtUserSignIn> signInIds = new HashSet<>();

标签:exception,hibernate,OneToMany,evaluate,userId,private,Unable,signInIds,Method
来源: https://blog.csdn.net/weixin_45353083/article/details/95219449