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<>();

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

解决方案

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

    @OneToMany(mappedBy = "userId",fetch = FetchType.EAGER)
    private Set<TtUserSignIn> signInIds = new HashSet<>();
上一篇:解决php7无法加载curl、intl、ldap的问题


下一篇:Android Butterknife简单使用方法,解决添加Butterknife8.8.1依赖后出错的问题,Unable to find method 'com.android.build