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 class
Version using a Long delegate.static final class
Version using a Timestamp delegate. -
Field Summary
FieldsFields 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 -
Method Summary
Modifier and TypeMethodDescriptionvoid
addColumnMapping
(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.int
Accessor for the number of column mappings.Obtains a value fromdatastoreResults
at position specified byexprIndex
.boolean
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
-
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: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
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
Description copied from class:JavaTypeMapping
Accessor for the column mappings for this java type- Overrides:
getColumnMappings
in classJavaTypeMapping
- Returns:
- The column mapping(s)
-
addColumnMapping
Description copied from class:JavaTypeMapping
Method to add a column mapping- Overrides:
addColumnMapping
in classJavaTypeMapping
- Parameters:
colMapping
- The column mapping
-
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
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
-