Hello,
Using 4.1.8.Final (I know, it’s old). I have an entity User which belongs to a Company. This user can have a few types of “membership”. Both directly (eg. User Record Type), and thru their associated Company (eg. Company Record Type). The memberships are a tree and so querying them “as is” is very cumbersome because of the rules (eg. if you have membership to something that is 2nd tier, but nothing explicit to a 3rd tier, then you implicity have membership to all 3rd tier items under 2nd tier). Anyhow, to make querying simpler, I created some views to “flatten” this layout and added a @OneToMany from User (ideally, these wouldn’t be views via something like CQRS, but I’m not there yet). In one of the views, the User is linked to a record via Company Id. When I try to delete the User, hibernate creates a CollectionRemoveAction which then tries to set the company id to null. Simply put, I just need hibernate to skip over these collections, but I’m not quite sure how to do that. There’s this CollectionEntry.isDoRemove flag which triggers the action creation. Seems like if that flag were false, then maybe I wouldn’t have this issue.
Here’s one mapping in particular for reference
@OneToMany
@JoinColumn(name = "SUPPLIER_ID", referencedColumnName = "SUPPLIER_ID")
@Immutable
public Set<EnterpriseRecordTypeMembership> getEnterpriseRecordTypeMemberships() {
return enterpriseRecordTypeMemberships;
}
Please advise. Thanks!