I have an entity (User) with a collection like so:
@ManyToMany(cascade = CascadeType.PERSIST)@JoinTable(name = "userroles", joinColumns = { @JoinColumn(name = "userid", referencedColumnName = "userid") }, inverseJoinColumns = { @JoinColumn(name = "roleid", referencedColumnName = "roleid") } )private Set validRoles;
This works fine. Role extends AbstractRole. If I change the sub-type of validRoles to Role, changes are not tracked. When I instantiate a new User, the ModifyListenMode of validRoles is ALL. After the user is loaded via a query or by find(class, id) the ModifyListenMode is null. This results in changes not being tracked and the many-to-many table not being updated.