Class ResultMetaDataROF
- java.lang.Object
-
- org.datanucleus.store.rdbms.query.AbstractROF
-
- org.datanucleus.store.rdbms.query.ResultMetaDataROF
-
- All Implemented Interfaces:
ResultObjectFactory
public class ResultMetaDataROF extends AbstractROF
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
Fields Modifier and Type Field Description protected ResultSetGetter[]
persistentTypeResultSetGetters
ResultSetGetter objects used for any persistable objects in the result.-
Fields inherited from class org.datanucleus.store.rdbms.query.AbstractROF
ec, fp, ignoreCache, rs
-
-
Constructor Summary
Constructors Constructor Description ResultMetaDataROF(org.datanucleus.ExecutionContext ec, ResultSet rs, boolean ignoreCache, org.datanucleus.FetchPlan fp, org.datanucleus.metadata.QueryResultMetaData qrmd)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
getObject()
Accessor for the object(s) from the current row of the ResultSet.ResultSet
getResultSet()
Accessor for the JDBC ResultSet being processed.
-
-
-
Field Detail
-
persistentTypeResultSetGetters
protected ResultSetGetter[] persistentTypeResultSetGetters
ResultSetGetter objects used for any persistable objects in the result. Set when processing the first row.
-
-
Constructor Detail
-
ResultMetaDataROF
public ResultMetaDataROF(org.datanucleus.ExecutionContext ec, ResultSet rs, boolean ignoreCache, org.datanucleus.FetchPlan fp, org.datanucleus.metadata.QueryResultMetaData qrmd)
Constructor.- Parameters:
ec
- ExecutionContextrs
- ResultSetignoreCache
- Whether we should ignore the cache(s) when instantiating persistable objectsfp
- FetchPlanqrmd
- MetaData defining the results from the query.
-
-
Method Detail
-
getResultSet
public ResultSet 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
public Object getObject()
Accessor for the object(s) from the current row of the ResultSet.- Returns:
- The object(s) for this row of the ResultSet.
-
-