|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.openjpa.jdbc.meta.strats.AbstractStrategy
org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy
org.apache.openjpa.jdbc.meta.strats.StateComparisonVersionStrategy
public class StateComparisonVersionStrategy
Uses a state image to determine whether concurrency violations take place.
| Nested Class Summary | |
|---|---|
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. |
| Field Summary | |
|---|---|
static java.lang.String |
ALIAS
|
| Fields inherited from class org.apache.openjpa.jdbc.meta.strats.AbstractVersionStrategy |
|---|
vers |
| Constructor Summary | |
|---|---|
StateComparisonVersionStrategy()
|
|
| Method Summary | |
|---|---|
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(java.lang.Object v1,
java.lang.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. |
java.lang.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. |
| 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 |
|---|
public static final java.lang.String ALIAS
| Constructor Detail |
|---|
public StateComparisonVersionStrategy()
| Method Detail |
|---|
public java.lang.String getAlias()
Strategy
getAlias in interface StrategygetAlias in class AbstractStrategypublic void map(boolean adapt)
Strategy
map in interface Strategymap in class AbstractStrategyadapt - if true, use the owning mapping's raw mapping info
to set its ORM data; if false, ORM data will already be set
public void insert(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
throws java.sql.SQLException
Strategy
insert in interface Strategyinsert in class AbstractStrategyjava.sql.SQLException
public void customInsert(OpenJPAStateManager sm,
JDBCStore store)
throws java.sql.SQLException
customInsert in interface StrategycustomInsert in class AbstractStrategyjava.sql.SQLException
public void update(OpenJPAStateManager sm,
JDBCStore store,
RowManager rm)
throws java.sql.SQLException
Strategy
update in interface Strategyupdate in class AbstractStrategyjava.sql.SQLExceptionStrategy.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 java.sql.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 manager
StateComparisonVersionStrategy.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
java.sql.SQLException
public void afterLoad(OpenJPAStateManager sm,
JDBCStore store)
VersionStrategy
afterLoad in interface VersionStrategyafterLoad in class AbstractVersionStrategy
public boolean checkVersion(OpenJPAStateManager sm,
JDBCStore store,
boolean updateVersion)
throws java.sql.SQLException
VersionStrategy
checkVersion in interface VersionStrategycheckVersion in class AbstractVersionStrategyjava.sql.SQLException
public int compareVersion(java.lang.Object v1,
java.lang.Object v2)
compareVersion in interface VersionStrategycompareVersion in class AbstractVersionStrategyStoreManager.compareVersion(org.apache.openjpa.kernel.OpenJPAStateManager, java.lang.Object, java.lang.Object)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||