Quote:
if I do this in Hibernate I indeed get the same child/owner from the DB, but they are different instances in java. With this i mean that if i change a property of the child then the owner list is not changed, because they are different instances. What I would like to do is make sure that trough pointers the same rows in a DB represent also the same object in java, so if one changes the other one gets update automatically trought pointers.
Have you really verified that this is the case? One very fundamental aspect of Hibernate is that
within a single Hibernate session a given row is represented by a single object instance. Due to proxies you may (in rare cases) see multiple instances in your code but all point to the same underlying "real" instance and changes made are immediately visible by all other proxies.
The above is true for work done in a single Hibernate session. If you start mixing objects loaded with different session it is a different matter and it is your own responsibility to handle.
There is a short note in the documentation about this:
http://docs.jboss.org/hibernate/stable/ ... s-identity