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 Saman Ghodsian <gs...@shaw.ca> on 2003/06/11 03:02:07 UTC

1:m relation not updating

Hi there, 

Here is the situation...... Say I have class A and class B   1----->m

I created the repository.xml 

Everything works fine when storing A to DB with a couple of B's

Tx.lock(a, Transaction.WRITE);
Tx.Commit


Next step is to load a and add more B's and then save it again.....

I created the query..... And all a and the related B's get loaded ok....

Now I add a couple more B's 
And store a 


Tx.lock(a, Transaction.WRITE);
Also tried 
Tx.lock(a, Transaction.UPGRADE);

But the new B's don't get inserted in DB.....
Any ideas????

Thanks



Sam


Re: 1:m relation not updating

Posted by Thomas Mahler <th...@web.de>.
You have to lock the b elements too if you are using normal collections 
to hold the many-side of the association.

If you were using DList as your collection class this won't be required.

cheers,
thomas

Saman Ghodsian wrote:
> Hi there, 
> 
> Here is the situation...... Say I have class A and class B   1----->m
> 
> I created the repository.xml 
> 
> Everything works fine when storing A to DB with a couple of B's
> 
> Tx.lock(a, Transaction.WRITE);
> Tx.Commit
> 
> 
> Next step is to load a and add more B's and then save it again.....
> 
> I created the query..... And all a and the related B's get loaded ok....
> 
> Now I add a couple more B's 
> And store a 
> 
> 
> Tx.lock(a, Transaction.WRITE);
> Also tried 
> Tx.lock(a, Transaction.UPGRADE);
> 
> But the new B's don't get inserted in DB.....
> Any ideas????
> 
> Thanks
> 
> 
> 
> Sam
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: ojb-user-unsubscribe@db.apache.org
> For additional commands, e-mail: ojb-user-help@db.apache.org
> 
>