You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-dev@db.apache.org by Ashish Rangole <as...@vexcel.com> on 2004/08/09 17:36:14 UTC

Unexpected commit behaviour with ODMG API in release 0.6

I apologise to cross-post this, but don't know the appropriate list.

I have exprerienced following commit behaviour and it does not seem like 
desired/expected/documented ones. I would like to know if this has 
changed in release 0.7 ->

  Object of type A has a collection of Objects of type B and vice-versa. 
They are mapped through a linker table and O-R mapping in XML has 
attribute auto-update="false", auto-retrieve="true" for both collections.

Case 1: A new object (not persisted yet) of class A has an instance of 
class B. Following sequence of operations is performed:
a)Open a transaction and write-lock the object A
b)Remove the object B instance from object A (set as null).
c)Commit Transaction. OJB persists the object of type A and then tries 
to persists the object B which was removed from object A prior to commit 
!!!
Is this right behaviour?? I was under impression that the final status 
of object prior to commit is the one that should be persisted and not 
the transient/intermediate one.

Case 2. Same objects A & B above with same relationships. Object B can 
contain another object L and B & L are mapped together by a linker 
table. Sequence of operations:-
a). Open a transaction and write-lock new object A which does not
contain instance of object B yet
b) Create object L and write lock it
c) Extract (query) existing instance of object B and write-lock it.
d) Insert newly created( and locked) instance of object L into object B
e) Add the object B to object A.
f) commit the transaction
On commit ODMG first persists object A but then although auto-update is 
"false", it tries to persist object B which fails because then it tries 
to populate the linker table between objects B & L which goes against 
referential integrity as L has not been persisted yet! Is this correct 
sequence? I was expecting the insertion sequence in the order of 
locking, i.e A followed by L followed by B and not A followed by B.

Any response will be highly appreciated. Thanks in advance for your
time and help.

Ashish


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