Class MappingHelper
java.lang.Object
org.datanucleus.store.rdbms.mapping.MappingHelper
Helper class for handling mappings.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static ObjectcreateObjectIdentityUsingReflection(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, Class objectIdClass) Create a user-defined id instance and fill the fields using reflection.protected static ObjectcreateSingleFieldIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, Class objectIdClass, Class pcClass) Create a SingleFieldIdentity instancestatic ObjectgetApplicationIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the application identity for the persistable instance from the passed result set row.static ObjectgetDatastoreIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the datastore identity for the persistable object from the passed result set row.static int[]getMappingIndices(int initialPosition, JavaTypeMapping mapping) Convenience method to return an array of positions for datastore columns for the supplied mapping and the initial position value.protected static ObjectgetObjectForAbstractClass(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Create an object id instance and fill the fields using reflectionstatic ObjectgetObjectForApplicationIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the persistent object instance for a class using application identity defined by the provided result set columnsstatic ObjectgetObjectForDatastoreIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the persistable object instance for a class using datastore identity defined by result set columns.
-
Constructor Details
-
MappingHelper
private MappingHelper()
-
-
Method Details
-
getMappingIndices
Convenience method to return an array of positions for datastore columns for the supplied mapping and the initial position value. For example if the mapping has a single datastore column and the initial position is 1 then returns the array {1}.- Parameters:
initialPosition- the initialPositionmapping- the Mapping- Returns:
- an array containing indexes for parameters
-
getObjectForDatastoreIdentity
public static Object getObjectForDatastoreIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the persistable object instance for a class using datastore identity defined by result set columns.- Parameters:
ec- ExecutionContextmapping- The mapping in which this is returnedrs- the ResultSetresultIndexes- indexes for the result setcmd- the AbstractClassMetaData- Returns:
- the persistable object
-
getDatastoreIdentityForResultSetRow
public static Object getDatastoreIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the datastore identity for the persistable object from the passed result set row.- Parameters:
ec- ExecutionContextmapping- The mapping in which this is returnedrs- the ResultSetresultIndexes- indexes for the result setcmd- the AbstractClassMetaData- Returns:
- the id
-
getApplicationIdentityForResultSetRow
public static Object getApplicationIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the application identity for the persistable instance from the passed result set row.- Parameters:
ec- ExecutionContextmapping- The Java Type mapping for the instancers- the ResultSetresultIndexes- indexes of the ResultSet for the PK field(s)cmd- the AbstractClassMetaData- Returns:
- the id
-
getObjectForApplicationIdentity
public static Object getObjectForApplicationIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Get the persistent object instance for a class using application identity defined by the provided result set columns- Parameters:
ec- ExecutionContextmapping- The mapping in which this is returnedrs- the ResultSetresultIndexes- indexes in the result set to retrievecmd- the AbstractClassMetaData- Returns:
- the persistent object instance
-
getObjectForAbstractClass
protected static Object getObjectForAbstractClass(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd) Create an object id instance and fill the fields using reflection- Parameters:
ec- ExecutionContextmapping- Mapping in which this is returnedrs- the ResultSetresultIndexes- indexes of the result set to usecmd- the AbstractClassMetaData- Returns:
- the id
-
createSingleFieldIdentity
protected static Object createSingleFieldIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, Class objectIdClass, Class pcClass) Create a SingleFieldIdentity instance- Parameters:
ec- ExecutionContextmapping- Mapping in which this is returnedrs- the ResultSetresultIndexes- the result set index(es)cmd- the AbstractClassMetaDataobjectIdClass- the object id classpcClass- the persistable class- Returns:
- the id
-
createObjectIdentityUsingReflection
protected static Object createObjectIdentityUsingReflection(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, Class objectIdClass) Create a user-defined id instance and fill the fields using reflection.- Parameters:
ec- ExecutionContextmapping- Mapping in which this is returnedrs- the ResultSetresultIndexes- the result set index(es)cmd- the AbstractClassMetaDataobjectIdClass- the object id class- Returns:
- the id
-