org.datanucleus.store.rdbms.query
Class ResultMetaDataROF
java.lang.Object
org.datanucleus.store.rdbms.query.ResultMetaDataROF
- All Implemented Interfaces:
- org.datanucleus.store.query.ResultObjectFactory
public class ResultMetaDataROF
- extends Object
- implements org.datanucleus.store.query.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)
Each call to getObject() will then return a set of objects as per the MetaData definition.
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] ... 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).
|
Field Summary |
protected static org.datanucleus.util.Localiser |
LOCALISER
Localisation of messages. |
|
Method Summary |
Object |
getObject(org.datanucleus.store.ExecutionContext ec,
Object rs)
Accessor for the object(s) from a row of the ResultSet. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
LOCALISER
protected static final org.datanucleus.util.Localiser LOCALISER
- Localisation of messages.
ResultMetaDataROF
public ResultMetaDataROF(RDBMSStoreManager storeMgr,
org.datanucleus.metadata.QueryResultMetaData qrmd)
- Constructor.
- Parameters:
storeMgr - RDBMS StoreManagerqrmd - MetaData defining the results from the query.
getObject
public Object getObject(org.datanucleus.store.ExecutionContext ec,
Object rs)
- Accessor for the object(s) from a row of the ResultSet.
- Specified by:
getObject in interface org.datanucleus.store.query.ResultObjectFactory
- Parameters:
ec - execution contextrs - ResultSet
- Returns:
- The object(s) for this row of the ResultSet.
Copyright © 2012. All Rights Reserved.