As I understand it, I cannot force Hibernate to use a xref table when modelling one-to-many relationships.
But this is something I would want to do by default.
If I have an entity, for example representing an Address, I want to relate that entity to many other entities (Client, Company, Branch, Department, Employee etc. etc.).
This means I keep having to add more and more foreign keys as the relationships are implemented. That's a pain for support, because ALTER TABLE has to be issued in the database.
Leaving aside arguments about the pros and cons of FKs versus xref, my point is I want to be able to choose, as I can in CMP (although I hate CMP for about 10 other reasons).
This is a barrier to adoption of Hibernate for us at the moment.
Can it be done (I hope I've missed something)? I could incorrectly model the relationship as many-to-many, but I don't want to do that.
|