Kodo 4.2.0. generated on July 28 2008

kodo.jdbc.meta.strats
Class LockGroupStateComparisonVersionStrategy

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

public class LockGroupStateComparisonVersionStrategy
extends AbstractVersionStrategy

Uses a state image to determine whether concurrency violations take place.

See Also:
Serialized Form

Nested Class Summary
static class LockGroupStateComparisonVersionStrategy.CustomUpdate
          Row implementation we use to pass to versionable mappings so they can set up the where conditions we need to add to update statements.
 
Field Summary
static String ALIAS
           
 
Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
vers
 
Constructor Summary
LockGroupStateComparisonVersionStrategy()
           
 
Method Summary
 void afterLoad(OpenJPAStateManager sm, JDBCStore store)
           
 boolean checkVersion(OpenJPAStateManager sm, JDBCStore store, boolean updateVersion)
           
 int compareVersion(Object v1, Object v2)
           
 void customInsert(OpenJPAStateManager sm, JDBCStore store)
          This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.
 LockGroupStateComparisonVersionStrategy.CustomUpdate customUpdate(OpenJPAStateManager sm, JDBCStore store, Table table, boolean record)
          This method is for class mappings that take over the update process, but still want to use this indicator for optimistic locking.
 String getAlias()
           
 void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
           
 void map(boolean adapt)
           
 void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm)
           
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
getBulkUpdateValues, load, select, setVersion
 
Methods inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractStrategy
customDelete, customUpdate, delete, initialize, 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, customUpdate, delete, initialize, isCustomDelete, isCustomInsert, isCustomUpdate
 

Field Detail

ALIAS

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

LockGroupStateComparisonVersionStrategy

public LockGroupStateComparisonVersionStrategy()
Method Detail

getAlias

public String getAlias()
Specified by:
getAlias in interface Strategy
Overrides:
getAlias in class AbstractStrategy

map

public void map(boolean adapt)
Specified by:
map in interface Strategy
Overrides:
map in class AbstractStrategy

insert

public void insert(OpenJPAStateManager sm,
                   JDBCStore store,
                   RowManager rm)
            throws SQLException
Specified by:
insert in interface Strategy
Overrides:
insert in class AbstractStrategy
Throws:
SQLException

customInsert

public void customInsert(OpenJPAStateManager sm,
                         JDBCStore store)
                  throws SQLException
This method is for class mappings that take over the insert process, but still want to use this indicator for optimistic locking.

Specified by:
customInsert in interface Strategy
Overrides:
customInsert in class AbstractStrategy
Throws:
SQLException

update

public void update(OpenJPAStateManager sm,
                   JDBCStore store,
                   RowManager rm)
            throws SQLException
Specified by:
update in interface Strategy
Overrides:
update in class AbstractStrategy
Throws:
SQLException

customUpdate

public LockGroupStateComparisonVersionStrategy.CustomUpdate customUpdate(OpenJPAStateManager sm,
                                                                         JDBCStore store,
                                                                         Table table,
                                                                         boolean record)
                                                                  throws SQLException
This method is for class mappings that take over the update process, but still want to use this indicator for optimistic locking.

Parameters:
sm - the instance to test
store - store manager context
table - only state image values in this table will be tested; if the custom mapping uses different updates for different tables, this method can be called multiple times for the multiple tables
record - set this parameter to true the last time you call this method, so the indicator can setup the next version of the given state manager
Returns:
a LockGroupStateComparisonVersionStrategy.CustomUpdate whose getSQL method yields a boolean SQL expression that tests whether the current record is equal to our recorded state image, and whose setParameters method parameterizes the given prepared statement with the values used in the above boolean expression
Throws:
SQLException

afterLoad

public void afterLoad(OpenJPAStateManager sm,
                      JDBCStore store)
Specified by:
afterLoad in interface VersionStrategy
Overrides:
afterLoad in class AbstractVersionStrategy

checkVersion

public boolean checkVersion(OpenJPAStateManager sm,
                            JDBCStore store,
                            boolean updateVersion)
                     throws SQLException
Specified by:
checkVersion in interface VersionStrategy
Overrides:
checkVersion in class AbstractVersionStrategy
Throws:
SQLException

compareVersion

public int compareVersion(Object v1,
                          Object v2)
Specified by:
compareVersion in interface VersionStrategy
Overrides:
compareVersion in class AbstractVersionStrategy

Kodo 4.2.0. generated on July 28 2008

Copyright 2001-2006 BEA Systems, Inc. All Rights Reserved.