@ManyToMany 联级删除

fetch = FetchType.EAGER 及时加载

联级删除必须加上 

nullable = false, updatable = false

 例如:

@ManyToMany(cascade = CascadeType.ALL,fetch = FetchType.EAGER)

@JoinTable(name = "user__reference_role", 

joinColumns = {@JoinColumn(name = "userid",nullable = false, updatable = false) }, 

inverseJoinColumns = { @JoinColumn(name = "roleid",nullable = false, updatable = false) })

你可能感兴趣的:(man)