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 classVersionMapping.VersionLongMappingVersion using a Long delegate.static classVersionMapping.VersionTimestampMappingVersion 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 voidaddColumnMapping(ColumnMapping colMapping)Method to add a column mappingColumnMappinggetColumnMapping(int index)Accessor for a column mappingColumnMapping[]getColumnMappings()Accessor for the column mappings for this java typeClassgetJavaType()Accessor for the java type being mapped.intgetNumberOfColumnMappings()Accessor for the number of column mappings.ObjectgetObject(org.datanucleus.ExecutionContext ec, ResultSet resultSet, int[] exprIndex)Obtains a value fromdatastoreResultsat position specified byexprIndex.booleanincludeInFetchStatement()Accessor for whether this mapping is to be included in any fetch statement.voidsetObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)Sets avalueintodatastoreStatementat 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:JavaTypeMappingAccessor for whether this mapping is to be included in any fetch statement.- Overrides:
includeInFetchStatementin classJavaTypeMapping- Returns:
- Whether to include this mapping in a fetch statement
-
getNumberOfColumnMappings
public int getNumberOfColumnMappings()
Description copied from class:JavaTypeMappingAccessor for the number of column mappings.- Overrides:
getNumberOfColumnMappingsin classJavaTypeMapping- Returns:
- the number of column mappings
-
getColumnMapping
public ColumnMapping getColumnMapping(int index)
Description copied from class:JavaTypeMappingAccessor for a column mapping- Overrides:
getColumnMappingin classJavaTypeMapping- Parameters:
index- The id of the column- Returns:
- The column mapping
-
getColumnMappings
public ColumnMapping[] getColumnMappings()
Description copied from class:JavaTypeMappingAccessor for the column mappings for this java type- Overrides:
getColumnMappingsin classJavaTypeMapping- Returns:
- The column mapping(s)
-
addColumnMapping
public void addColumnMapping(ColumnMapping colMapping)
Description copied from class:JavaTypeMappingMethod to add a column mapping- Overrides:
addColumnMappingin classJavaTypeMapping- Parameters:
colMapping- The column mapping
-
getJavaType
public Class getJavaType()
Description copied from class:JavaTypeMappingAccessor 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:
getJavaTypein classJavaTypeMapping- Returns:
- The java type
-
setObject
public void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] exprIndex, Object value)Description copied from class:JavaTypeMappingSets avalueintodatastoreStatementat position specified byexprIndex.- Overrides:
setObjectin 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:JavaTypeMappingObtains a value fromdatastoreResultsat position specified byexprIndex.- Overrides:
getObjectin classSingleFieldMapping- Parameters:
ec- ExecutionContextresultSet- ResultSetexprIndex- the position of the value in the result- Returns:
- the value
-
-