| In PersistentMap.java, PersistentSet.java, PersistentList.java equals() and hashCode() methods are implemented correctly. In PersistentBag.java they are not. So to be consistent, hibernate should either remove or add equals() and hashCode() methods from/to all of them. i.e. the current situation is undesireable for all. Either way, hibernate influences the equals/hash-code behavior of the entities/value-objects. That is not good, since this should not be the choice of the orm. As suggested, this behaviour should be configurabled (and consistent). Hibernate should as well not enforce business-key equality as stated in https://vladmihalcea.com/2013/10/23/hibernate-facts-equals-and-hashcode/. This is not the choice of the orm. Often this cannot be achieved since there simply is no business-key: value-objects have no business-key since every attribute is key, applications consider not to model a business-key, there is no valid unique business-key, the business-key is a list, ... |