ch.elca.el4j.services.persistence.generic.dto
Class AbstractIntOptimisticLockingDto

java.lang.Object
  extended by ch.elca.el4j.services.persistence.generic.dto.AbstractIntOptimisticLockingDto
All Implemented Interfaces:
OptimisticLockingObject, Serializable
Direct Known Subclasses:
AbstractIntKeyIntOptimisticLockingDto, AbstractStringKeyIntOptimisticLockingDto

@MappedSuperclass
public abstract class AbstractIntOptimisticLockingDto
extends Object
implements Serializable, OptimisticLockingObject

This is an abstract class for optimistic locking. The used version type is an integer. In java code the update count must be checked to know if the version number on database has been increased. If yes, the version number of dto must be increased too.

Java code:


 ...
     MyTableDto myDto = ...
     SqlMapClientTemplate smc = ...
     int count = smc.update("updateMyTable", myDto);
     if (count == 1) {
         myDto.increaseOptimisticLockingVersion();
     }
 ...
 

Author:
Martin Zeltner (MZE)
See Also:
Serialized Form
File-location:
AbstractIntOptimisticLockingDto
Last check-in date:
2009-08-04 13:59:45 +0200 (Di, 04. Aug 2009) by swismer for revision 3873

Constructor Summary
AbstractIntOptimisticLockingDto()
           
 
Method Summary
 int getOptimisticLockingVersion()
           
 void increaseOptimisticLockingVersion()
          Method to increase the int optimistic locking version number.
 void setOptimisticLockingVersion(int optimisticLockingVersion)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractIntOptimisticLockingDto

public AbstractIntOptimisticLockingDto()
Method Detail

getOptimisticLockingVersion

public int getOptimisticLockingVersion()
Returns:
Returns the optimistic locking version.

setOptimisticLockingVersion

public void setOptimisticLockingVersion(int optimisticLockingVersion)
Parameters:
optimisticLockingVersion - The optimistic locking version to set.

increaseOptimisticLockingVersion

public void increaseOptimisticLockingVersion()
Method to increase the int optimistic locking version number.

Specified by:
increaseOptimisticLockingVersion in interface OptimisticLockingObject


Copyright © 2005-2011 ELCA. All Rights Reserved.