Class UUIDMapping
java.lang.Object
org.datanucleus.store.rdbms.mapping.java.JavaTypeMapping
org.datanucleus.store.rdbms.mapping.java.SingleFieldMapping
org.datanucleus.store.rdbms.mapping.java.UUIDMapping
Mapping for fields of type java.util.UUID.
Makes use of a TypeConverter (converting to String) as default, but if the user provides sqlType then attempts to find a native sqlType and avoids using a TypeConverter.
TODO If an sqlType is specified but wanted to use a String conversion then this process will likely fail, so needs improving.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) org.datanucleus.store.types.converters.TypeConverterFields 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 TypeMethodDescriptionAccessor for the java type being mapped.getJavaTypeForColumnMapping(int index) Accessor for the name of the java-type actually used when mapping the particular datastore field.Obtains a value fromdatastoreResultsat position specified byexprIndex.voidinitialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr) Initialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.voidinitialize(RDBMSStoreManager storeMgr, String type) Initialise this JavaTypeMapping with the given StoreManager for the given type.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, getLong, getShort, getString, getValidValues, prepareColumnMapping, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setShort, setStringMethods inherited from class JavaTypeMapping
addColumnMapping, equals, failureMessage, getAbsoluteFieldNumber, getColumnMapping, getColumnMappings, getColumnMetaDataForMember, getMemberMetaData, getNumberOfColumnMappings, getObject, getReferenceMapping, getRoleForMember, getStoreManager, getTable, getType, getValueForColumnMapping, hashCode, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, isNullable, isSerialised, performSetPostProcessing, representableAsStringLiteralInStatement, requiresSetPostProcessing, setAbsFieldNumber, setMemberMetaData, setObject, setReferenceMapping, setRoleForMember, setTable
-
Field Details
-
converter
org.datanucleus.store.types.converters.TypeConverter converter
-
-
Constructor Details
-
UUIDMapping
public UUIDMapping()
-
-
Method Details
-
initialize
Description copied from class:JavaTypeMappingInitialise this JavaTypeMapping with the given StoreManager for the given type. Used when the mapping is for a parameter in a query. This will not set the "mmd" and "datastoreContainer" parameters. If these are required for usage of the mapping then you should call setFieldInformation(AbstractMemberMetaData, DatastoreContainerObject) below. Subclasses should override this method to perform any datastore initialization operations.- Overrides:
initializein classJavaTypeMapping- Parameters:
storeMgr- The Datastore Adapter that this Mapping should use.type- The Class that this mapping maps to the database.
-
initialize
public void initialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr) Description copied from class:SingleFieldMappingInitialize this JavaTypeMapping with the given DatastoreAdapter for the given FieldMetaData.- Overrides:
initializein classSingleFieldMapping- Parameters:
mmd- FieldMetaData for the field to be mapped (if any)table- The datastore container storing this mapping (if any)clr- the ClassLoaderResolver
-
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
-
getJavaTypeForColumnMapping
Description copied from class:SingleFieldMappingAccessor for the name of the java-type actually used when mapping the particular datastore field. This java-type must have an entry in the datastore mappings.- Overrides:
getJavaTypeForColumnMappingin classSingleFieldMapping- Parameters:
index- requested column index.- Returns:
- the name of java-type for the requested column.
-
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
-