public void updateLockingValues ( Object obj ) throws PersistenceBrokerException { FieldDescriptor [ ] fields = getLockingFields ( ) ; for ( int i = 0 ; i < fields . length ; i ++ ) { FieldDescriptor fmd = fields [ i ] ; if ( fmd . isUpdateLock ( ) ) { PersistentField f = fmd . getPersistentField ( ) ; Object cv = f . get ( obj ) ; // int if ( ( f . getType ( ) == int . class ) || ( f . getType ( ) == Integer . class ) ) { int newCv = 0 ; if ( cv != null ) { newCv = ( ( Number ) cv ) . intValue ( ) ; } newCv ++ ; f . set ( obj , new Integer ( newCv ) ) ; } // long else if ( ( f . getType ( ) == long . class ) || ( f . getType ( ) == Long . class ) ) { long newCv = 0 ; if ( cv != null ) { newCv = ( ( Number ) cv ) . longValue ( ) ; } newCv ++ ; f . set ( obj , new Long ( newCv ) ) ; } // Timestamp else if ( f . getType ( ) == Timestamp . class ) { long newCv = System . currentTimeMillis ( ) ; f . set ( obj , new Timestamp ( newCv ) ) ; } } } }
updates the values for locking fields BRJ handles int long Timestamp respects updateLock so locking field are only updated when updateLock is true