hibernate异常

<h1> nested exception is org.hibernate.LazyInitializationException:</h1>

 

stackoverflow:http://stackoverflow.com/questions/36106620/failed-to-lazily-initialize-a-collection-of-role-user-authorities-could-not-in

 

也可以

@ManyToMany(fetch = FetchType.LAZY)  ==》 (fetch = FetchType.EAGER)
@Fetch(FetchMode.SUBSELECT)
@JoinTable(
name = "sys_user_role",
joinColumns = { @JoinColumn(name = "role_id") },
inverseJoinColumns = @JoinColumn(name = "user_id")
)
@JsonIgnore
public Set<SysUser> getSysUsers() {
return sysUsers;
}

public void setSysUsers(Set<SysUser> sysUsers) {
this.sysUsers = sysUsers;
}
posted @ 2016-07-04 15:09  FEI_>.<_JI  阅读(161)  评论(0编辑  收藏  举报