ritesh_randomgmail wrote:
Kaj,
I am trying to understand this better. Would you mind positing the schema for your two tables? And if you feeling generous, then could you provide the ddl stmts that Hibernate used to created those tables?
Thanks for answering!
I have put a "desc" in sqlplus of the two tables at
http://folk.uio.no/kajh/tmp/onetoone.txt
This is a legacy database we have "inherited", so I don't have the ddl stmts.
I'm beginning to think it might have been better to make the relationship a one-to-many (which it in fact is in the database).
but... since in practice each work object only can have one and only one xmlmetadata object we made it a one-to-one relationship in hibernate. I'm getting more and more unsure how smart this decision was...
After searching the hibernate jira for issues regarding one-to-one relationships I'm beginning to wonder if we should change this into a one-to-many and make a wrapper metod retining just the first object of the collection (getXmlMetadata returning the first object in getXmlMetadatas if size > 0 else return null.
It would be interesting to hear from other people out there who use (or have tried to use) one-to-one relationships in hibernate. What are their experience with one-to-one relationships?
-Kaj :)