org.datanucleus.store.rdbms.query
Class ResultMetaDataROF

java.lang.Object
  extended by org.datanucleus.store.rdbms.query.ResultMetaDataROF
All Implemented Interfaces:
org.datanucleus.store.query.ResultObjectFactory

public class ResultMetaDataROF
extends java.lang.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 :-

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.
 
Constructor Summary
ResultMetaDataROF(org.datanucleus.metadata.QueryResultMetaData qrmd)
          Constructor.
 
Method Summary
 java.lang.Object getObject(org.datanucleus.ObjectManager om, java.lang.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
 

Field Detail

LOCALISER

protected static final org.datanucleus.util.Localiser LOCALISER
Localisation of messages.

Constructor Detail

ResultMetaDataROF

public ResultMetaDataROF(org.datanucleus.metadata.QueryResultMetaData qrmd)
Constructor.

Parameters:
qrmd - MetaData defining the results from the query.
Method Detail

getObject

public java.lang.Object getObject(org.datanucleus.ObjectManager om,
                                  java.lang.Object rs)
Accessor for the object(s) from a row of the ResultSet.

Specified by:
getObject in interface org.datanucleus.store.query.ResultObjectFactory
Parameters:
om - ObjectManager
rs - ResultSet
Returns:
The object(s) for this row of the ResultSet.


Copyright © 2009. All Rights Reserved.