Class VersionMapping
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
-
- org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
-
- org.datanucleus.store.rdbms.mapping.java.VersionMapping
-
- Direct Known Subclasses:
VersionMapping.VersionLongMapping
,VersionMapping.VersionTimestampMapping
public class VersionMapping extends SingleFieldMapping
Mapping class for mapping version state/timestamp columns in the database. This class is for internal use only. It should not be used in user mappings.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
VersionMapping.VersionLongMapping
Version using a Long delegate.static class
VersionMapping.VersionTimestampMapping
Version using a Timestamp delegate.
-
Field Summary
-
Fields inherited from class org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
EXTENSION_CHECK_CONSTRAINT_VALUES
-
Fields inherited from class org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
absFieldNumber, columnMappings, mmd, referenceMapping, roleForMember, storeMgr, table, type
-
-
Constructor Summary
Constructors Constructor Description VersionMapping(Table table, JavaTypeMapping delegate)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addColumnMapping(ColumnMapping colMapping)
Method to add a column mappingColumnMapping
getColumnMapping(int index)
Accessor for a column mappingColumnMapping[]
getColumnMappings()
Accessor for the column mappings for this java typeClass
getJavaType()
Accessor for the java type being mapped.int
getNumberOfColumnMappings()
Accessor for the number of column mappings.Object
getObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)
Obtains a value fromdatastoreResults
at position specified byexprIndex
.boolean
includeInFetchStatement()
Accessor for whether this mapping is to be included in any fetch statement.void
setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)
Sets avalue
intodatastoreStatement
at position specified byexprIndex
.-
Methods inherited from class org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getJavaTypeForColumnMapping, getLong, getShort, getString, getValidValues, initialize, prepareColumnMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setString
-
Methods inherited from class org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
equals, failureMessage, getAbsoluteFieldNumber, getColumnMetaDataForMember, getMemberMetaData, getObject, getReferenceMapping, getRoleForMember, getStoreManager, getTable, getType, getValueForColumnMapping, hashCode, hasSimpleDatastoreRepresentation, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, performSetPostProcessing, representableAsStringLiteralInStatement, requiresSetPostProcessing, setAbsFieldNumber, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember, setTable
-
-
-
-
Constructor Detail
-
VersionMapping
public VersionMapping(Table table, JavaTypeMapping delegate)
Constructor.- Parameters:
table
- Datastore tabledelegate
- The JavaTypeMapping to delegate the storage
-
-
Method Detail
-
includeInFetchStatement
public boolean includeInFetchStatement()
Description copied from class:JavaTypeMapping
Accessor for whether this mapping is to be included in any fetch statement.- Overrides:
includeInFetchStatement
in classJavaTypeMapping
- Returns:
- Whether to include this mapping in a fetch statement
-
getNumberOfColumnMappings
public int getNumberOfColumnMappings()
Description copied from class:JavaTypeMapping
Accessor for the number of column mappings.- Overrides:
getNumberOfColumnMappings
in classJavaTypeMapping
- Returns:
- the number of column mappings
-
getColumnMapping
public ColumnMapping getColumnMapping(int index)
Description copied from class:JavaTypeMapping
Accessor for a column mapping- Overrides:
getColumnMapping
in classJavaTypeMapping
- Parameters:
index
- The id of the column- Returns:
- The column mapping
-
getColumnMappings
public ColumnMapping[] getColumnMappings()
Description copied from class:JavaTypeMapping
Accessor for the column mappings for this java type- Overrides:
getColumnMappings
in classJavaTypeMapping
- Returns:
- The column mapping(s)
-
addColumnMapping
public void addColumnMapping(ColumnMapping colMapping)
Description copied from class:JavaTypeMapping
Method to add a column mapping- Overrides:
addColumnMapping
in classJavaTypeMapping
- Parameters:
colMapping
- The column mapping
-
getJavaType
public Class getJavaType()
Description copied from class:JavaTypeMapping
Accessor for the java type being mapped. This is the java type that the mapping represents. Some examples :- if the field is of type "MyClass" then the mapping will be OIDMapping (or subclass) the javaType will be OID, and the type will be MyClass.
- if the field is of type "int" then the mapping will be IntegerMapping, the javaType will be Integer, and the type will be int.
- Specified by:
getJavaType
in classJavaTypeMapping
- Returns:
- The java type
-
setObject
public void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)
Description copied from class:JavaTypeMapping
Sets avalue
intodatastoreStatement
at position specified byexprIndex
.- Overrides:
setObject
in classSingleFieldMapping
- Parameters:
ec
- ExecutionContextps
- PreparedStatementexprIndex
- the position of the value in the statementvalue
- the value
-
getObject
public Object getObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)
Description copied from class:JavaTypeMapping
Obtains a value fromdatastoreResults
at position specified byexprIndex
.- Overrides:
getObject
in classSingleFieldMapping
- Parameters:
ec
- ExecutionContextresultSet
- ResultSetexprIndex
- the position of the value in the result- Returns:
- the value
-
-