public abstract class ReferenceMapping extends MultiPersistableMapping implements MappingCallbacks
Modifier and Type | Field and Description |
---|---|
static int |
ID_MAPPING
Single column containing the "identity" of an object.
|
protected int |
mappingStrategy
Strategy for how the reference(s) are mapped.
|
static int |
PER_IMPLEMENTATION_MAPPING
Each implementation has its own column(s) as a FK to the related table.
|
static int |
XCALIA_MAPPING
Single column containing the Xcalia form of the "identity" of an object.
|
javaTypeMappings, numberOfDatastoreMappings
absFieldNumber, datastoreMappings, mmd, referenceMapping, roleForMember, storeMgr, table, type
Constructor and Description |
---|
ReferenceMapping() |
Modifier and Type | Method and Description |
---|---|
Class |
getJavaType()
Accessor for the java type being mapped.
|
String |
getJavaTypeForDatastoreMapping(int index)
Accessor for the java type represented by a particular datastore mapping.
|
int |
getMappingNumberForValue(org.datanucleus.ExecutionContext ec,
Object value)
Convenience accessor for the number of the java type mapping where the passed value would be
stored.
|
int |
getMappingStrategy()
Accessor for the mapping strategy.
|
Object |
getObject(org.datanucleus.ExecutionContext ec,
ResultSet rs,
int[] pos)
Method to retrieve an object of this type from the ResultSet.
|
protected Object |
getObjectForReferenceString(org.datanucleus.ExecutionContext ec,
String refString)
Method to convert a "reference string" into the associated object.
|
protected String |
getReferenceStringForObject(org.datanucleus.ExecutionContext ec,
Object value)
Method to convert an object to be stored into a "reference string" to store.
|
void |
initialize(org.datanucleus.metadata.AbstractMemberMetaData mmd,
Table table,
org.datanucleus.ClassLoaderResolver clr)
Initialize this JavaTypeMapping for the specified field/property.
|
void |
insertPostProcessing(org.datanucleus.state.ObjectProvider op)
Method executed just after the insert of the owning object, allowing any necessary action
to this field and the object stored in it.
|
void |
postFetch(org.datanucleus.state.ObjectProvider op)
Method executed just after a fetch of the owning object, allowing any necessary action
to this field and the object stored in it.
|
void |
postInsert(org.datanucleus.state.ObjectProvider op)
Method executed just after the insert of the owning object, allowing any necessary action
to this field and the object stored in it.
|
void |
postUpdate(org.datanucleus.state.ObjectProvider op)
Method executed just afer any update of the owning object, allowing any necessary action
to this field and the object stored in it.
|
void |
preDelete(org.datanucleus.state.ObjectProvider op)
Method executed just before the owning object is deleted, allowing tidying up of any
relation information.
|
protected void |
prepareDatastoreMapping(org.datanucleus.ClassLoaderResolver clr)
Convenience method to create the necessary columns to represent this reference in the datastore.
|
void |
setObject(org.datanucleus.ExecutionContext ec,
PreparedStatement ps,
int[] pos,
Object value,
org.datanucleus.state.ObjectProvider ownerOP,
int ownerFieldNumber)
Sets the specified positions in the PreparedStatement associated with this field, and value.
|
setObject
addJavaTypeMapping, getDatastoreMapping, getDatastoreMappings, getJavaTypeMapping, getNumberOfDatastoreMappings
addDatastoreMapping, equals, failureMessage, getAbsoluteFieldNumber, getBoolean, getByte, getChar, getColumnMetaDataForMember, getDouble, getFloat, getInt, getLong, getMemberMetaData, getObject, getReferenceMapping, getRoleForMember, getShort, getStoreManager, getString, getTable, getType, getValueForDatastoreMapping, hashCode, hasSimpleDatastoreRepresentation, includeInFetchStatement, includeInInsertStatement, includeInUpdateStatement, initialize, isNullable, isSerialised, representableAsStringLiteralInStatement, setAbsFieldNumber, setBoolean, setByte, setChar, setDouble, setFloat, setInt, setLong, setMemberMetaData, setReferenceMapping, setRoleForMember, setShort, setString, setTable
public static final int PER_IMPLEMENTATION_MAPPING
public static final int ID_MAPPING
public static final int XCALIA_MAPPING
protected int mappingStrategy
public void initialize(org.datanucleus.metadata.AbstractMemberMetaData mmd, Table table, org.datanucleus.ClassLoaderResolver clr)
initialize
in class JavaTypeMapping
mmd
- AbstractMemberMetaData for the field to be mapped (if any)table
- The datastore container storing this mapping (if any)clr
- the ClassLoaderResolverpublic int getMappingStrategy()
protected void prepareDatastoreMapping(org.datanucleus.ClassLoaderResolver clr)
clr
- The ClassLoaderResolverpublic String getJavaTypeForDatastoreMapping(int index)
getJavaTypeForDatastoreMapping
in class JavaTypeMapping
index
- requested datastore field index.public int getMappingNumberForValue(org.datanucleus.ExecutionContext ec, Object value)
getMappingNumberForValue
in class MultiPersistableMapping
ec
- ExecutionContextvalue
- The valuepublic void setObject(org.datanucleus.ExecutionContext ec, PreparedStatement ps, int[] pos, Object value, org.datanucleus.state.ObjectProvider ownerOP, int ownerFieldNumber)
setObject
in class MultiPersistableMapping
ec
- the ExecutionContextps
- a datastore object that executes statements in the databasepos
- The position(s) of the PreparedStatement to populatevalue
- the value stored in this fieldownerOP
- the owner ObjectProviderownerFieldNumber
- the owner absolute field numberpublic Object getObject(org.datanucleus.ExecutionContext ec, ResultSet rs, int[] pos)
getObject
in class MultiPersistableMapping
ec
- ExecutionContextrs
- The ResultSetpos
- The parameter positionspublic Class getJavaType()
JavaTypeMapping
getJavaType
in class JavaTypeMapping
protected String getReferenceStringForObject(org.datanucleus.ExecutionContext ec, Object value)
ec
- ExecutionContextvalue
- The objectprotected Object getObjectForReferenceString(org.datanucleus.ExecutionContext ec, String refString)
ec
- execution contextrefString
- The reference stringpublic void postFetch(org.datanucleus.state.ObjectProvider op)
postFetch
in interface MappingCallbacks
op
- ObjectProvider for the owner.public void insertPostProcessing(org.datanucleus.state.ObjectProvider op)
insertPostProcessing
in interface MappingCallbacks
op
- ObjectProvider for the owner.public void postInsert(org.datanucleus.state.ObjectProvider op)
postInsert
in interface MappingCallbacks
op
- ObjectProvider for the owner.public void postUpdate(org.datanucleus.state.ObjectProvider op)
postUpdate
in interface MappingCallbacks
op
- ObjectProvider for the owner.public void preDelete(org.datanucleus.state.ObjectProvider op)
preDelete
in interface MappingCallbacks
op
- ObjectProvider for the owner.Copyright © 2015. All rights reserved.