Hi,
I have a special case here: There are two Java objects ObjectA and ObjectB. At the database level, I need to have three tables
1. TableA (for ObjectA)
2. TableB (for ObjectB)
3. TableAB (extra table)
The relationship should be of the type:
1. Table A has one-to-many with TableAB (inverse - true)
2. Table AB has one-to-one with TableB (If it was many-to-one with TableB, that would be a piece of cake!)
My problem is due to the following:
1. Hibernate creates the extra table TableAB only if ObjectA has many-to-many relation with another another object (ObjectB).
2. If I define one-to-many for ObjectA, Hibernate ignores creation of TableAB.
3. If I define many-to-many for ObjectA (by specifying TableAB be created) and then define one-to-one for ObjectB, then Hibernate does create TableAB but it does not update.
4. If I had ObjectAB, then it would be easy but I don't this object.
Is there a way to achieve this?
Thanks in advance,
Madhan.
|