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...@yahoo.com> on 2003/08/01 06:47:30 UTC

1:1 mapping

Folks,

We have a simple parent-child relationship mapping
with navigability in both directions (parent has
association for child and vice-versa), with fk
references in both repository descriptors pointing to
the other. Everything seemed to be working (as far as
autoupdate) except that today, we turned on a
constraint (Oracle) that says the parent must exist
when the child is created. It immediately broke the
unit tests, giving a 'constraint violation', implying
that the parent was not in existence when the child
was trying to be created. Sure enuf, looking at the
emitted sql (p6spy) seems to show that the child gets
created first. Again, we are simply trying create a
parent-child relationship, by building the object tree
and then storing the parent. 

Is there anyway to force which creation occurs first?
One would think that it would be natural to think that
the parent would be created first, or at least that
you guys would have provided for this constraint; it
seems so natural.

thanks in advance,

hba 

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org


Re: 1:1 mapping

Posted by Thomas Mahler <th...@web.de>.
Hi Hal,

I think the problem is the bidirectional association.
If you would simply use an unidirectional association
OJB will evaluate this association and insert Objects in the correct 
order. If there is a birectional association specified OJB does not know 
which side is the master that must be inserted first!

cheers,
Thomas

hal arnold wrote:
> Folks,
> 
> We have a simple parent-child relationship mapping
> with navigability in both directions (parent has
> association for child and vice-versa), with fk
> references in both repository descriptors pointing to
> the other. Everything seemed to be working (as far as
> autoupdate) except that today, we turned on a
> constraint (Oracle) that says the parent must exist
> when the child is created. It immediately broke the
> unit tests, giving a 'constraint violation', implying
> that the parent was not in existence when the child
> was trying to be created. Sure enuf, looking at the
> emitted sql (p6spy) seems to show that the child gets
> created first. Again, we are simply trying create a
> parent-child relationship, by building the object tree
> and then storing the parent. 
> 
> Is there anyway to force which creation occurs first?
> One would think that it would be natural to think that
> the parent would be created first, or at least that
> you guys would have provided for this constraint; it
> seems so natural.
> 
> thanks in advance,
> 
> hba 
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! SiteBuilder - Free, easy-to-use web site design software
> http://sitebuilder.yahoo.com
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
> 


---------------------------------------------------------------------
To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
For additional commands, e-mail: ojb-user-help@db.apache.org