You are viewing a plain text version of this content. The canonical link for it is here.
Posted to ojb-user@db.apache.org by "Weaver, Scott" <Sw...@rippe.com> on 2003/06/26 15:17:18 UTC

ODMG update "bug" moving from rc3 to rc4 (CVS HEAD)

In ODMG, I have a 1:1 relationship between object A and object B.  I retrieve object A using PB.  I proceed to make a change to object B that was materialized along with object A.  I then pass object A to a method that contains the code below, update(A).  In rc3 object B's changes were made persistent to the RDBMS however in the current CVS HEAD, they are not.



public void update(Object object)
{
pb = getBroker();
// 1. remove object from the OJB cache
pb.removeFromCache(object);

// 2. Start the transaction
Transaction tx = odmg.newTransaction();
tx.begin();

// 3. retreive a "stale" version of this object from the db
Identity id = new Identity(object, pb);
Object staleObject = pb.getObjectByIdentity(id);
tx.lock(staleObject, Transaction.WRITE); 

// 4. Map new values to the stale object
BeanUtils.copyProperties(staleObject, object);

// 5. Commit the transaction
tx.commit();
}

			
      









*===================================*
* Scott T Weaver                    *
* Jakarta Jetspeed Portal Project   *
* weaver@apache.org                 *
*===================================*