I also have the same question:
Why should I use unidirectional @OneToMany relationships when the corresponding bi-directional relationships seem to perform better? In fact, that is what chapter 23 (Example: Parent/Child) of Hibernate manual says; that is, bidirectional uses less SQL statements during updates. In addition, with a bi-directional we can benefit from the Cascade operations.
On the other hand, if I use unidirectional @OneToMany relationship Hibernate "hbm2ddl" (hibernate3-maven-plugin) ends up generating a join table which makes the DB schemas more complex. Because now we have extra join-tables to manage, making eventual future migrations of data harder, since we have to account for the join tables as well as the two other tables.
Again, why should I use a unidirectional one-to-many relationship instead of the bidirectional one-to-many ?
Thanks,
Rubens.
_________________ --
Rubens Gomes
www.rubens-gomes.com
|