Hi Phil,

DiCorpo, Phillip wrote:
I'm having a problem removing objects in a 1:N relationship in OJB 1.0.4
using OMDG.  Assume you have an object Role that can have one or more
Permission objects.  If I lock just the Role object for WRITE, remove a
Permission object from this Role, and then commit the transaction I'll
get the following exception:

Caused by: org.apache.ojb.odmg.TransactionAbortedExceptionOJB: Can't
commit objects: Unexpected behaviour, unregistered object to delete:
Permission[1]

In OJB.properties ImplicitLocking=false and Ordering=true.  The
collection descriptor in the Role class descriptor looks something like
the following:

<collection-descriptor name="permissions"
element-class-ref="org.test.Permission" proxy="true"
collection-class="org.apache.ojb.broker.util.collections.RemovalAwareLis
t" auto-delete="object" auto-update="none">

                <inverse-foreignkey field-id-ref="2"/>

</collection-descriptor>

Locking the Permission object before removing it seems to solve the
problem.  Any ideas?  Please let me know if you need any additional
information.  Thanks in advance for the help,


You set ImplicitLocking false, in this case the user is responsible to lock (register) all objects involved in a tx.
You have two possibilities:
1. Enable ImpliciteLocking at runtime (at begin of your tx) using OJB's ODMG extensions
http://db.apache.org/ojb/docu/guides/odmg-guide.html#The+TransactionExt+Interface
2. Lock all involved objects by hand. In your case WRITE lock the removed Permission too.

regards,
Armin


--Phil

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