Hi again Shane

Shane Mingins wrote:
Hi Thomas

These are probably going to be "dumb" questions but I cannot find answers
anywhere.  [The mail list archive is so frustrating to use.]

1. How do I lock 'b' elements from a collection using the ODMG API?

tx.lock(b, Transaction.WRITE);



2. Can I double check regarding the collection-descriptor
auto-retrieve/update/delete that in the Advanced O/R is states:


"These default settings are mandatory for proper operation of the ODMG and
JDO implementation."

that this means accept the defaults when using ODMG?  (I get errors when I
set auto-update="true", but when using deletePersistent(obj) I found setting
auto-delete="true" removed the 'b' elements but when not set the 'b'
elements remained persisted.

The above statement is really true don't use auto-update="true" and auto-delete="true" in ODMG.
Setting them to true results in double execution of updates and deletes which agains results in the execptions you see.


To delete B instance b use Database.deletePersistent(b);



3. As DList is abstract what would I use in a model object to store 'b' elements? I see where the Implementation object can create a new DList odmg.newDList() ????

In your object you can type the attribute as DList.
In the repository you have to declare the collection type as o.a.ojb.odmg.collections.DListImpl.
odmg.newDList() instantiates a DListImpl.
using this factory method is the ODMG way to instantiate a DList.


cheers,
Thomas


Cheers Shane


-----Original Message-----
From: Thomas Mahler [mailto:[EMAIL PROTECTED] Sent: Wednesday, 11 June 2003 5:51 p.m.
To: OJB Users List
Subject: Re: 1:m relation not updating


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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]





--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to