org.datanucleus.store.rdbms.request
Class FetchRequest2

java.lang.Object
  extended by org.datanucleus.store.rdbms.request.Request
      extended by org.datanucleus.store.rdbms.request.FetchRequest2

public class FetchRequest2
extends Request

Class to retrieve the fields of an object of a specified class from the datastore. If some of those fields are themselves persistent objects then this can optionally retrieve fields of those objects in the same fetch.

Any surrogate version stored in this table will be fetched *if* the object being updated doesn't already have a value for it. If the caller wants the surrogate version to be updated then they should nullify the "transactional" version before calling.


Field Summary
 
Fields inherited from class org.datanucleus.store.rdbms.request.Request
key, LOCALISER, table
 
Constructor Summary
FetchRequest2(org.datanucleus.store.mapped.DatastoreClass classTable, org.datanucleus.metadata.AbstractMemberMetaData[] mmds, java.lang.Class cls, org.datanucleus.ClassLoaderResolver clr)
          Constructor, taking the table.
 
Method Summary
 void execute(org.datanucleus.StateManager sm)
          Method to execute the request - to be implemented by deriving classes.
protected  int processMembersOfClass(SQLStatement sqlStatement, java.lang.Class cls, org.datanucleus.metadata.AbstractMemberMetaData[] mmds, org.datanucleus.store.mapped.DatastoreClass table, SQLTable sqlTbl, org.datanucleus.store.mapped.StatementClassMapping mappingDef, java.util.Collection fetchCallbacks, org.datanucleus.ClassLoaderResolver clr)
          Method to process the supplied members of the class, adding to the SQLStatement as required.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FetchRequest2

public FetchRequest2(org.datanucleus.store.mapped.DatastoreClass classTable,
                     org.datanucleus.metadata.AbstractMemberMetaData[] mmds,
                     java.lang.Class cls,
                     org.datanucleus.ClassLoaderResolver clr)
Constructor, taking the table. Uses the structure of the datastore table to build a basic query.

Parameters:
classTable - The Class Table representing the datastore table to retrieve
mmds - MetaData of the fields/properties to retrieve
cls - Class of objects being fetched
clr - ClassLoader resolver
Method Detail

execute

public void execute(org.datanucleus.StateManager sm)
Description copied from class: Request
Method to execute the request - to be implemented by deriving classes.

Specified by:
execute in class Request
Parameters:
sm - The StateManager for the object in question.

processMembersOfClass

protected int processMembersOfClass(SQLStatement sqlStatement,
                                    java.lang.Class cls,
                                    org.datanucleus.metadata.AbstractMemberMetaData[] mmds,
                                    org.datanucleus.store.mapped.DatastoreClass table,
                                    SQLTable sqlTbl,
                                    org.datanucleus.store.mapped.StatementClassMapping mappingDef,
                                    java.util.Collection fetchCallbacks,
                                    org.datanucleus.ClassLoaderResolver clr)
Method to process the supplied members of the class, adding to the SQLStatement as required. Can recurse if some of the requested fields are persistent objects in their own right, so we take the opportunity to retrieve some of their fields.

Parameters:
sqlStatement - Statement being built
cls - The class
mmds - Meta-data for the required fields/properties
table - The table to look for member mappings
sqlTbl - The table in the SQL statement to use for selects
fetchCallbacks - Any additional required callbacks are added here
Returns:
Number of fields being fetched


Copyright © 2009. All Rights Reserved.