public class StateComparisonVersionStrategy extends AbstractVersionStrategy
Modifier and Type | Class and Description |
---|---|
static class |
StateComparisonVersionStrategy.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.
|
Modifier and Type | Field and Description |
---|---|
static String |
ALIAS |
vers
Constructor and Description |
---|
StateComparisonVersionStrategy() |
Modifier and Type | Method and Description |
---|---|
void |
afterLoad(OpenJPAStateManager sm,
JDBCStore store)
This method is called after data is loaded into the instance, in
case the version indicator works off of a state image.
|
boolean |
checkVersion(OpenJPAStateManager sm,
JDBCStore store,
boolean updateVersion)
Checks the version of the given state manager with the version
stored in memory.
|
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.
|
StateComparisonVersionStrategy.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()
Return the alias of this strategy.
|
void |
insert(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set values for the mapping into the proper rows.
|
void |
map(boolean adapt)
Map the owning mapping using this strategy.
|
void |
update(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
Set values for the mapping into the proper rows.
|
getBulkUpdateValues, load, load, select, setVersion
customDelete, customUpdate, delete, initialize, isCustomDelete, isCustomInsert, isCustomUpdate
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
customDelete, customUpdate, delete, initialize, isCustomDelete, isCustomInsert, isCustomUpdate
public static final String ALIAS
public String getAlias()
Strategy
getAlias
in interface Strategy
getAlias
in class AbstractStrategy
public void map(boolean adapt)
Strategy
map
in interface Strategy
map
in class AbstractStrategy
adapt
- if true, use the owning mapping's raw mapping info
to set its ORM data; if false, ORM data will already be setpublic void insert(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
insert
in interface Strategy
insert
in class AbstractStrategy
SQLException
public void customInsert(OpenJPAStateManager sm, JDBCStore store) throws SQLException
customInsert
in interface Strategy
customInsert
in class AbstractStrategy
SQLException
public void update(OpenJPAStateManager sm, JDBCStore store, RowManager rm) throws SQLException
Strategy
update
in interface Strategy
update
in class AbstractStrategy
SQLException
Strategy.insert(org.apache.openjpa.kernel.OpenJPAStateManager, org.apache.openjpa.jdbc.kernel.JDBCStore, org.apache.openjpa.jdbc.sql.RowManager)
public StateComparisonVersionStrategy.CustomUpdate customUpdate(OpenJPAStateManager sm, JDBCStore store, Table table, boolean record) throws SQLException
sm
- the instance to teststore
- store manager contexttable
- 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 tablesrecord
- set this parameter to true the last time you call
this method, so the indicator can setup the next
version of the given state managerStateComparisonVersionStrategy.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 expressionSQLException
public void afterLoad(OpenJPAStateManager sm, JDBCStore store)
VersionStrategy
afterLoad
in interface VersionStrategy
afterLoad
in class AbstractVersionStrategy
public boolean checkVersion(OpenJPAStateManager sm, JDBCStore store, boolean updateVersion) throws SQLException
VersionStrategy
checkVersion
in interface VersionStrategy
checkVersion
in class AbstractVersionStrategy
SQLException
public int compareVersion(Object v1, Object v2)
compareVersion
in interface VersionStrategy
compareVersion
in class AbstractVersionStrategy
StoreManager.compareVersion(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object, java.lang.Object)
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.