Package org.apache.openjpa.jdbc.meta
Interface VersionStrategy
-
- All Superinterfaces:
java.io.Serializable
,Strategy
- All Known Implementing Classes:
AbstractVersionStrategy
,ColumnVersionStrategy
,MultiColumnVersionStrategy
,NanoPrecisionTimestampVersionStrategy
,NoneVersionStrategy
,NumberVersionStrategy
,StateComparisonVersionStrategy
,SuperclassVersionStrategy
,TimestampVersionStrategy
,Version
public interface VersionStrategy extends Strategy
Handles optimistic lock versioning for a class.- Author:
- Abe White
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method 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(java.lang.Object v1, java.lang.Object v2)
java.util.Map<Column,?>
getBulkUpdateValues()
java.lang.Object
load(OpenJPAStateManager sm, JDBCStore store, Result res)
Load data.java.lang.Object
load(OpenJPAStateManager sm, JDBCStore store, Result res, Joins joins)
Load data.boolean
select(Select sel, ClassMapping mapping)
Select the data for this indicator.void
setVersion(Version owner)
Set the version that uses this strategy.-
Methods inherited from interface org.apache.openjpa.jdbc.meta.Strategy
customDelete, customInsert, customUpdate, delete, getAlias, initialize, insert, isCustomDelete, isCustomInsert, isCustomUpdate, map, update
-
-
-
-
Method Detail
-
setVersion
void setVersion(Version owner)
Set the version that uses this strategy. This will be called before use.
-
select
boolean select(Select sel, ClassMapping mapping)
Select the data for this indicator.- Parameters:
mapping
- the known base class being selected; this may not be the base class in the inheritance hierarchy- Returns:
- true if anything was selected; false otherwise
-
load
java.lang.Object load(OpenJPAStateManager sm, JDBCStore store, Result res) throws java.sql.SQLException
Load data.- Throws:
java.sql.SQLException
-
load
java.lang.Object load(OpenJPAStateManager sm, JDBCStore store, Result res, Joins joins) throws java.sql.SQLException
Load data.- Throws:
java.sql.SQLException
-
afterLoad
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.
-
checkVersion
boolean checkVersion(OpenJPAStateManager sm, JDBCStore store, boolean updateVersion) throws java.sql.SQLException
Checks the version of the given state manager with the version stored in memory.- Returns:
- true if the in-memory version was up-to-date, false otherwise
- Throws:
java.sql.SQLException
-
compareVersion
int compareVersion(java.lang.Object v1, java.lang.Object v2)
-
getBulkUpdateValues
java.util.Map<Column,?> getBulkUpdateValues()
- Returns:
- a Map
specifying how to update each version column during a bulk update. - Since:
- 1.0.0
-
-