I'm having trouble managing locks in my object graph, mostly because of implicit
locking. I have the following code:
tx = odmg.newTransaction();
tx.begin();
UserDefinedSite site = findSiteBySomeQuery();
...
tx.lock(site, tx.WRITE);
...
tx.lock(site.getDescription(), tx.WRITE);
tx.commit();
The second call to lock() throws LockNotGrantedException; it appears that OJB
believes it cannot obtain a lock because the description object is already
locked, even though that lock is held by the current transaction.
I am using 0.9.8 (with the next revision of ObjectEnvelopeTable after the
release), and I have ImplicitLocking=true and LockAssociations=WRITE.
Should this code work? If so, any clues why it doesn't?
The relevant portion of repository.xml:
<class-descriptor
class="gov.doi.cap.dataobjects.UserDefinedSite"
table="USER_DEFINED_SITE" >
<field-descriptor id="1"
name="siteId"
column="SITE_ID"
jdbc-type="INTEGER"
primarykey="true"
/>
<reference-descriptor
name="description"
class-ref="gov.doi.cap.dataobjects.SiteDescriptionImpl" >
<foreignkey field-id-ref="1" />
</reference-descriptor>
</class-descriptor>
<class-descriptor
class="gov.doi.cap.dataobjects.SiteDescriptionImpl"
proxy="dynamic"
table="SITE_DESCRIPTION" >
<field-descriptor id="1"
name="siteId"
column="SITE_ID"
jdbc-type="INTEGER"
primarykey="true"
autoincrement="true"
sequence-name="SiteID"
/>
</class-descriptor>
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>