Class MappingHelper
- java.lang.Object
-
- org.datanucleus.store.rdbms.mapping.MappingHelper
-
public class MappingHelper extends java.lang.ObjectHelper class for handling mappings.
-
-
Constructor Summary
Constructors Modifier Constructor Description privateMappingHelper()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description protected static java.lang.ObjectcreateObjectIdentityUsingReflection(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, java.lang.Class objectIdClass)Create a user-defined id instance and fill the fields using reflection.protected static java.lang.ObjectcreateSingleFieldIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, java.lang.Class objectIdClass, java.lang.Class pcClass)Create a SingleFieldIdentity instancestatic java.lang.ObjectgetApplicationIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd)Get the application identity for the persistable instance from the passed result set row.static java.lang.ObjectgetDatastoreIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.ObjectgetObjectForAbstractClass(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd)Create an object id instance and fill the fields using reflectionstatic java.lang.ObjectgetObjectForApplicationIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.ObjectgetObjectForDatastoreIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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.
-
-
-
Method Detail
-
getMappingIndices
public 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. 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 java.lang.Object getObjectForDatastoreIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.Object getDatastoreIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.Object getApplicationIdentityForResultSetRow(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.Object getObjectForApplicationIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.Object getObjectForAbstractClass(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.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 java.lang.Object createSingleFieldIdentity(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, java.lang.Class objectIdClass, java.lang.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 java.lang.Object createObjectIdentityUsingReflection(org.datanucleus.ExecutionContext ec, JavaTypeMapping mapping, java.sql.ResultSet rs, int[] resultIndexes, org.datanucleus.metadata.AbstractClassMetaData cmd, java.lang.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
-
-