I am reading "Java Persistence with Hibernate", 2007 edition. Chap 3 page 119 says:
Quote:
You should consider the static methods Collections.unmodifiedCollection(c) and Collections.unmodifiableSet(s), if you prefer to wrap the internal collections before returning them in your getter method.
on page 122 it says:
Quote:
Collections are compared by identity! For a property mapped as a persistent collection, you should return exactly the same collection instance from the getter method that Hibernate passed to the setter method. If you don't, Hibernate will update the database, even if no update is necessary, every time the state held in memory is synchronized with the database.
Given the response to this posting:
https://forum.hibernate.org/viewtopic.php?t=938019, it appears that the latter quote supersedes the former. Am I right in interpreting this to mean you can't really encapsulate collections and control their access under Hibernate?
Thanks.