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
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 ClassesModifier and TypeClassDescriptionstatic final classVersion using a Long delegate.static final classVersion using a Timestamp delegate. -
Field Summary
FieldsFields inherited from class SingleFieldMapping
EXTENSION_CHECK_CONSTRAINT_VALUESFields inherited from class JavaTypeMapping
absFieldNumber, columnMappings, mmd, referenceMapping, roleForMember, storeMgr, table, type -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddColumnMapping(ColumnMapping colMapping) Method to add a column mappinggetColumnMapping(int index) Accessor for a column mappingAccessor for the column mappings for this java typeAccessor for the java type being mapped.intAccessor for the number of column mappings.Obtains a value fromdatastoreResultsat position specified byexprIndex.booleanAccessor 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 SingleFieldMapping
getBoolean, getByte, getChar, getDefaultLength, getDouble, getFloat, getInt, getJavaTypeForColumnMapping, getLong, getShort, getString, getValidValues, initialize, prepareColumnMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setStringMethods inherited from class 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
-
Field Details
-
delegate
-
-
Constructor Details
-
VersionMapping
Constructor.- Parameters:
table- Datastore tabledelegate- The JavaTypeMapping to delegate the storage
-
-
Method Details
-
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
Description copied from class:JavaTypeMappingAccessor for a column mapping- Overrides:
getColumnMappingin classJavaTypeMapping- Parameters:
index- The id of the column- Returns:
- The column mapping
-
getColumnMappings
Description copied from class:JavaTypeMappingAccessor for the column mappings for this java type- Overrides:
getColumnMappingsin classJavaTypeMapping- Returns:
- The column mapping(s)
-
addColumnMapping
Description copied from class:JavaTypeMappingMethod to add a column mapping- Overrides:
addColumnMappingin classJavaTypeMapping- Parameters:
colMapping- The column mapping
-
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
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
-