Class ResultMetaDataROF
java.lang.Object
org.datanucleus.store.rdbms.query.AbstractROF
org.datanucleus.store.rdbms.query.ResultMetaDataROF
- All Implemented Interfaces:
ResultObjectFactory
ResultObjectFactory that operates using a QueryResultMetaData and returns objects based on the definition.
A QueryResultMetaData allows for a row of a ResultSet to be returned as a mix of :-
- a number of persistent objects (made up of several ResultSet columns)
- a number of Objects (from individual ResultSet columns)
ResultSet to object mapping
Each row of the ResultSet has a set of columns, and these columns are either used for direct outputting back to the user as a "simple" object, or as a field in a persistent object. So you could have a situation like this :-ResultSet Column Output Object ================ ============= COL1 PC1.field1 COL2 PC1.field2 COL3 Simple Object COL4 PC2.field3 COL5 PC2.field1 COL6 PC2.field2 COL7 Simple Object COL8 PC1.field3 ...So this example will return an Object[4] comprised of Object[0] = instance of PC1, Object[1] = instance of PC2, Object[2] = simple object, Object[3] = simple object. When creating the instance of PC1 we take the ResultSet columns (COL1, COL2, COL8). When creating the instance of PC2 we take the ResultSet columns (COL5, COL6, COL4).
Columns to persistable object mapping
Where we have a number of columns forming a persistable object, such as (COL1, COL2, COL8) above we make use of ResultSetGetter to populate the fields of the persistable object from the ResultSet.-
Field Summary
FieldsModifier and TypeFieldDescription(package private) String[]
Column names in the ResultSet.protected ResultSetGetter[]
ResultSetGetter objects used for any persistable objects in the result.(package private) org.datanucleus.metadata.QueryResultMetaData
MetaData defining the result from the Query.Fields inherited from class org.datanucleus.store.rdbms.query.AbstractROF
ec, fp, ignoreCache, rs, updateAllFields
-
Constructor Summary
ConstructorsConstructorDescriptionResultMetaDataROF
(org.datanucleus.ExecutionContext ec, ResultSet rs, org.datanucleus.FetchPlan fp, org.datanucleus.metadata.QueryResultMetaData qrmd) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionAccessor for the object(s) from the current row of the ResultSet.Accessor for the JDBC ResultSet being processed.Methods inherited from class org.datanucleus.store.rdbms.query.AbstractROF
setIgnoreCache, setUpdateAllFields
-
Field Details
-
queryResultMetaData
org.datanucleus.metadata.QueryResultMetaData queryResultMetaDataMetaData defining the result from the Query. -
columnNames
String[] columnNamesColumn names in the ResultSet. -
persistentTypeResultSetGetters
ResultSetGetter objects used for any persistable objects in the result. Set when processing the first row.
-
-
Constructor Details
-
ResultMetaDataROF
public ResultMetaDataROF(org.datanucleus.ExecutionContext ec, ResultSet rs, org.datanucleus.FetchPlan fp, org.datanucleus.metadata.QueryResultMetaData qrmd) Constructor.- Parameters:
ec
- ExecutionContextrs
- ResultSetfp
- FetchPlanqrmd
- MetaData defining the results from the query.
-
-
Method Details
-
getResultSet
Description copied from interface:ResultObjectFactory
Accessor for the JDBC ResultSet being processed.- Specified by:
getResultSet
in interfaceResultObjectFactory
- Overrides:
getResultSet
in classAbstractROF
- Returns:
- The ResultSet
-
getObject
Accessor for the object(s) from the current row of the ResultSet.- Returns:
- The object(s) for this row of the ResultSet.
-