Hi,

Rajadurai K wrote:
Hi,
  we will call broker.store(C) for each object in the collection first then
we will call broker.store(A)


You set auto-update="true" in both references, thus OJB will automatically store the referenced objects too.
If you call
broker.store(A)
OJB should first update object A and then start updating the 1:n reference to C. When storing C OJB will detect the 1:1 (n:1) reference back to A and try to store A again (but A is already updated thus OJB should break) and then C itself will be stored.

What happen when you only call broker.store(A)?

regards,
Armin

Regards
Rajadurai.


-----Original Message-----
From: Armin Waibel [mailto:[EMAIL PROTECTED]
Sent: Wednesday, January 18, 2006 8:56 PM
To: OJB Users List
Subject: Re: Optimistic Locking with PB API for 1:M


Hi Rajadurai,

Rajadurai K wrote:

Hi,
   We are using OJB PB API in one of out application. we are trying to do
the locking for the following
scenario.


class A{
 some fields;
 Integer  versionMaintainedbyOjb;
 Collection  Cs;
}
Class C {
 some fields
  A   a
 Integer  versionMaintainedbyOjb;
}


In our repository.xml   We had given auto-update="object"  for both
collection-descriptor and reference descriptor.
We gave locking="true" for versionMaintainedbyOjb in the class descriptor

of

both the class.

When we try to update Object of "A" which is having collection of objects

of

C.
First updating of each object in the collection is happening. At that time
value of "versionMaintainedbyOjb" for A is getting
updated in the data base.  So finally when we try to update A it is giving
OptimisticLockException.



So you only call
broker.store(A)
in your source?
If not could you please post a code example or some pseudo code?
Do you use proxies for the references?

regards,
Armin


Am i going in the right way?. Please help me. Thanks in advance.

Rajadurai.




---------------------------------------------------------------------
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