org.apache.openjpa.jdbc.meta.strats
Class MultiColumnVersionStrategy

java.lang.Object
  extended by org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
      extended by org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
          extended by org.apache.openjpa.jdbc.meta.strats.ColumnVersionStrategy
              extended by org.apache.openjpa.jdbc.meta.strats.NumberVersionStrategy
                  extended by org.apache.openjpa.jdbc.meta.strats.MultiColumnVersionStrategy
All Implemented Interfaces:
Serializable, Strategy, VersionStrategy

public class MultiColumnVersionStrategy
extends NumberVersionStrategy

Uses multiple version numbers spanning multiple columns for optimistic versioning.

Since:
1.3.0
Author:
Pinaki Poddar
See Also:
Serialized Form

Field Summary
static String ALIAS
           
 
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
vers
 
Constructor Summary
MultiColumnVersionStrategy()
           
 
Method Summary
 String getAlias()
          Return the alias of this strategy.
 Number[] getInitialValues()
          Return the initial values for version columns.
protected  int getJavaType()
          Return the code from JavaTypes for the version values this strategy uses.
protected  int getJavaType(int i)
          Return the code from JavaTypes for the version value this given column index uses.
 void initialize()
          Perform caching and other initialization operations.
protected  Object nextVersion(Object version)
          Return the next version given the current one, which may be null.
 void setInitialValues(Number[] initial)
          Set the initial value for version columns.
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.NumberVersionStrategy
getBulkUpdateValues, getInitialValue, setInitialValue
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.ColumnVersionStrategy
checkVersion, compare, compare, compareVersion, delete, insert, load, map, select, update
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
afterLoad, setVersion
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customInsert, customUpdate, isCustomDelete, isCustomInsert, isCustomUpdate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, isCustomDelete, isCustomInsert, isCustomUpdate
 

Field Detail

ALIAS

public static final String ALIAS
See Also:
Constant Field Values
Constructor Detail

MultiColumnVersionStrategy

public MultiColumnVersionStrategy()
Method Detail

initialize

public void initialize()
Description copied from interface: Strategy
Perform caching and other initialization operations. This method is called after Strategy.map(boolean), and after all related components have been mapped as well.

Specified by:
initialize in interface Strategy
Overrides:
initialize in class AbstractStrategy

setInitialValues

public void setInitialValues(Number[] initial)
Set the initial value for version columns. Defaults to 1 for each column.


getInitialValues

public Number[] getInitialValues()
Return the initial values for version columns. Defaults to 1 for each column.


getAlias

public String getAlias()
Description copied from interface: Strategy
Return the alias of this strategy. For custom strategies, return the full class name.

Specified by:
getAlias in interface Strategy
Overrides:
getAlias in class NumberVersionStrategy

getJavaType

protected int getJavaType()
Description copied from class: ColumnVersionStrategy
Return the code from JavaTypes for the version values this strategy uses. This method is only used during mapping installation.

Overrides:
getJavaType in class NumberVersionStrategy

getJavaType

protected int getJavaType(int i)
Description copied from class: ColumnVersionStrategy
Return the code from JavaTypes for the version value this given column index uses. Only used if the version strategy employs more than one column.

Overrides:
getJavaType in class ColumnVersionStrategy

nextVersion

protected Object nextVersion(Object version)
Description copied from class: ColumnVersionStrategy
Return the next version given the current one, which may be null.

Overrides:
nextVersion in class NumberVersionStrategy


Copyright © 2006-2010 Apache Software Foundation. All Rights Reserved.