While using OTM we've found the following issue:
we have object type Doc and a collection Doc.relatedDocs with elements of type Doc (M-to-N association with indirection table).
Two threads load the same object D of type Doc into their contexts.
The first thread successfully adds instance D1 to D.relatedDocs. We see appropriate changes in DB after committing a transaction.
After that having old version of D in it's context second thread tries to add another instance D2 to D.relatedDocs. Transaction succefully commits and we see that link between D and D1 in indirection table has gone (method PersistentBrokerImpl.storeAndLinkMtoN deletes all entries in indirection table which are not part of referenced objects), and link between D and D2 is present. That is we have just overwritten new data with old data.
It seems that this situation should be treated just like a normal optimistic locking and second thread shouldn't succeed.
Could someone please clarify this issue? Thanks in advance.
Andrew Shevel
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
