org.datanucleus.store.rdbms.query
Class PersistentIDROF

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

public final class PersistentIDROF
extends java.lang.Object
implements org.datanucleus.store.query.ResultObjectFactory

ResultObjectFactory that takes a JDBC ResultSet and create a PersistenceCapable object instance for each row in the ResultSet. We use information in the result set to determine the object type; this can be a discriminator column, or can be a special "NucleusType" column defined just for result processing.


Field Summary
protected  org.datanucleus.metadata.AbstractClassMetaData acmd
          Metadata for the candidate class.
protected  boolean discriminator
          Flag whether we should use a discriminator column to distinguish object types (otherwise use NUCLEUS_TYPE).
protected  org.datanucleus.FetchPlan fetchPlan
          Fetch Plan to use when loading fields (if any).
protected static org.datanucleus.util.Localiser LOCALISER
          Localiser for messages.
protected  org.datanucleus.store.mapped.StatementClassMapping stmtMapping
          Mapping for the statement to members of this class (and sub-objects).
 
Constructor Summary
PersistentIDROF(org.datanucleus.store.mapped.MappedStoreManager storeMgr, org.datanucleus.store.mapped.DatastoreClass table, org.datanucleus.metadata.AbstractClassMetaData acmd, org.datanucleus.store.mapped.StatementClassMapping mappingDefinition, boolean ignoreCache, boolean discriminator, org.datanucleus.FetchPlan fetchPlan, java.lang.Class persistentClass)
          Constructor.
 
Method Summary
 java.lang.Object getObject(org.datanucleus.ObjectManager om, java.lang.Object rs)
          Method to convert the current ResultSet row into an Object.
 void setPersistentClass(java.lang.Class cls)
          Method to update the persistent class that the result object factory requires.
 
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
Localiser for messages.


acmd

protected final org.datanucleus.metadata.AbstractClassMetaData acmd
Metadata for the candidate class.


stmtMapping

protected org.datanucleus.store.mapped.StatementClassMapping stmtMapping
Mapping for the statement to members of this class (and sub-objects).


discriminator

protected boolean discriminator
Flag whether we should use a discriminator column to distinguish object types (otherwise use NUCLEUS_TYPE).


fetchPlan

protected final org.datanucleus.FetchPlan fetchPlan
Fetch Plan to use when loading fields (if any).

Constructor Detail

PersistentIDROF

public PersistentIDROF(org.datanucleus.store.mapped.MappedStoreManager storeMgr,
                       org.datanucleus.store.mapped.DatastoreClass table,
                       org.datanucleus.metadata.AbstractClassMetaData acmd,
                       org.datanucleus.store.mapped.StatementClassMapping mappingDefinition,
                       boolean ignoreCache,
                       boolean discriminator,
                       org.datanucleus.FetchPlan fetchPlan,
                       java.lang.Class persistentClass)
Constructor.

Parameters:
storeMgr - Manager of the datastore
table - Table being selected from
acmd - MetaData for the class (base class)
mappingDefinition - Mapping information for the result set and how it maps to the class
ignoreCache - Whether to ignore the cache
discriminator - Whether we use a discriminator column to distinguish object types
fetchPlan - the Fetch Plan
persistentClass - Class that this factory will create instances of (or subclasses)
Method Detail

setPersistentClass

public void setPersistentClass(java.lang.Class cls)
Method to update the persistent class that the result object factory requires. This is used where we have an Extent(BaseClass) and we pass it to a JDOQL query but the query has been specified with a candidate class that is a subclass. So we use this method to restrict the results further.

Parameters:
cls - The Class the result factory requires.

getObject

public java.lang.Object getObject(org.datanucleus.ObjectManager om,
                                  java.lang.Object rs)
Method to convert the current ResultSet row into an Object.

Specified by:
getObject in interface org.datanucleus.store.query.ResultObjectFactory
Parameters:
om - The ObjectManager
rs - The ResultSet from the Query.
Returns:
The (persisted) object.


Copyright © 2009. All Rights Reserved.