我有两个实体类,在那些字段上有多对多关系。 他们在这里:
public class TCustomerProfile {
...
@ManyToMany(fetch = FetchType.EAGER, cascade = {CascadeType.PERSIST, CascadeType.MERGE},mappedBy = "customers")
private List<TUserProfile> users;
...
}
public class TUserProfile{
...
@JoinTable(name = "T_USER_AUTHORIZATION",
joinColumns = {@JoinColumn(name = "USER_ID" ,referencedColumnName ="USER_ID")/*,@JoinColumn(name = "ENTITY1" ,referencedColumnName ="ENTITY")*/ },
inverseJoinColumns = { @JoinColumn(name = "CUSTOMER_ID" ,referencedColumnName ="CUSTOMER_ID")/*,@JoinColumn(name = "ENTITY" ,referencedColumnName ="ENTITY")*/} )
@ManyToMany(fetch = FetchType.EAGER)
private List<TCustomerProfile> customers;
...
}
现在的问题是:
TCustomerProfile.users
中的某个用户null
是如何成为可能的呢?
这三个表(包括join table t_user_authorization
)中的某些数据组合会导致这种情况吗?