Thomas Matzner wrote:
You don't [i]have[/] to use bidirectional relations. It's just as you suggested: Decide whether you need them in your classes, and if not, leave that inverse stuff away. Hibernate's saving to the database won't be affected by this, i.e. it will save the objects and set the foreign key right, no matter whether the association is bidirectional or not.
Loading the associated objects together with an objects is a totally different matter. It is controlled by the lazy parameter -- see the docs.
Ok so only use them when you need them in the business side, i guess. That is awesome that it will automatically set the foreign key for you.
I am still a bit confused as to where you put the inverse attribute vs where you put the cascade attribute in a bi-directional association.
Thomas Matzner wrote:
Adding delete-orphan will delete the associated object if it's orphaned (not referenced by any object) any more.
So "all" isn't really "all" it is all but delete-orppan?