You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by Hal Arnold <ha...@cj.com> on 2003/05/28 21:26:58 UTC

Help on 1:1 associations

GentleFolk,

I'd love someone to point me to the junit example of the 1:1 association, 
particularily one that stores the associated object tree. I've looked at 
the OneToOneTest,PersistenceBrokerTest, and BrokerExamples
without a clue as to how it should be done. Maybe I don't understand, 
but I'd like to create the object tree, and do a store like so:

A parent has a child. I'd like both to be auto created (db wise). 
I'd like to create the parent object, create the child, do a 
parent.setChild(child)and say: broker.store(parent) only. I'd like 
to have the child with a new id, the parent with a new id 
and the child with the parent's id as the reference. I've been successful 
with storing the child (navigation from the child to the parent only), but 
so far (as in the OneToOneTest), I've not been able to do the above without 
doing stores on both the parent and child. Am I being unreasonable? 
I've followed the ProductGroup, Article examples assiduously, but with 
reference to the junit test, I can't see that it actually works the way 
I've articulated. So, maybe it doesn't. Do I have to programmatically 
store on both the parent and the child?


-hba