Hi!
    Does anyone use the PersistentLockMapImpl? I get a problem when I use 
PersistentLockMapImpl for lock map.
I have two classes A and B. Their relation is non-decomposed association ,and their 
collection-descriptor be set proxy="true" each other.
Like as:
     <class-descriptor class="A" table="A">
      <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true" 
autoincrement="true" nullable="false"/>
      <field-descriptor name="currentState" column="currentState" jdbc-type="INTEGER" 
nullable="false"/>
      <collection-descriptor name="Bs" 
collection-class="org.apache.ojb.odmg.collections.DListImpl" element-class-ref="B" 
          indirection-table="A_B" proxy="true">
          <fk-pointing-to-this-class column="AOID"/>
           <fk-pointing-to-element-class column="BOID"/>
      </collection-descriptor>
     </class-descriptor>
 
     <class-descriptor class="B" table="B">
      <field-descriptor name="OID" column="OID" jdbc-type="CHAR" primarykey="true" 
autoincrement="true" nullable="false"/>
      <field-descriptor name="currentState" column="currentState" jdbc-type="INTEGER" 
nullable="false"/>
      <collection-descriptor name="As" 
collection-class="org.apache.ojb.odmg.collections.DListImpl" element-class-ref="A" 
          indirection-table="A_B" proxy="true">
          <fk-pointing-to-this-class column="BOID"/>
           <fk-pointing-to-element-class column="AOID"/>
      </collection-descriptor>
     </class-descriptor>

In my case, I use ODMG API to operate object persistence. At the same transaction , I 
first select a object of class A then select a 
object of class B and set a new value to B's currentState property. After the 
transaction finishing, the value of B's currentState did 
not be changed in database. I confirm it work if I set 
LockMapClass=org.apache.ojb.odmg.locking.InMemoryLockMapImpl in the OJB.properties 
file.Because our application has multi OJB instance at the same time, I must set 
LockMapClass=org.apache.ojb.odmg.locking.PersistentLockMapImpl.

The lock properties are 

LockManagerClass=org.apache.ojb.odmg.locking.LockManagerDefaultImpl
LockMapClass=org.apache.ojb.odmg.locking.PersistentLockMapImpl
LockTimeout=60000
ImplicitLocking=true
LockAssociations=WRITE and 
ObjectCacheClass=org.apache.ojb.broker.cache.ObjectCacheEmptyImpl

In my program , I new a Transaction.READ type transaction to query A and B.

I try to query B first before query A, then set a new value to B's currentState 
property. The OJB ODMG can update field of B success even 
LockMapClass=org.apache.ojb.odmg.locking.PersistentLockMapImpl.

Does anybody know why it is or tell me how to solve this problem? 

Reply via email to