org.jpox.store.rdbms.extent
Class ClassTableExtent

java.lang.Object
  extended byorg.jpox.store.extent.AbstractExtent
      extended byorg.jpox.store.rdbms.extent.ClassTableExtent
All Implemented Interfaces:
javax.jdo.Extent, Queryable

public class ClassTableExtent
extends AbstractExtent
implements Queryable

An Extent of all persistent objects backed by a class table. There are 3 inheritance strategies, and each is handled by this class but in different ways.

subclass-table Strategy

In this case a class does not have its own table and its fields are persisted to the table of a subclass. If the class requiring the Extent is the "subclass-table" class, then there will be an array of tables where objects of this type can be persisted (as the base table). For this reason the caller passes in an array of tables.

new-table Strategy

In this case the class has its own table, and so there is only one base table for the class. The array of tables passed in will be of size 1.

superclass-table Strategy

In this case the class doesn't have its own table, BUT will be persisted into the table of its superclass. In this case the array of tables passed in will be of size 1 (the superclass' table).

Version:
$Revision: 1.39 $

Field Summary
protected static Localiser LOCALISER_RDBMS
          Localised messages
 
Fields inherited from class org.jpox.store.extent.AbstractExtent
candidateClass, cmd, LOCALISER, pm, query, queryResultsByIterator, storeMgr, subclasses
 
Constructor Summary
ClassTableExtent(PersistenceManager pm, DatastoreClass[] tables, java.lang.Class cls, boolean subclasses)
          Constructor.
ClassTableExtent(PersistenceManager pm, DatastoreClass table, java.lang.Class cls, boolean subclasses)
          Constructor.
 
Method Summary
 boolean isEmpty()
          Returns true if this collection contains no elements.
 QueryExpression newQueryStatement()
          Create a new query to search for the candidate classes etc.
 QueryExpression newQueryStatement(java.lang.Class candidateClass)
          Create a query to search for instances of the candidateClass and its subclasses (if required).
 Query.ResultObjectFactory newResultObjectFactory(QueryExpression stmt, boolean ignoreCache, java.lang.Class resultClass, boolean useFetchPlan)
          Create a new factory for objects from the ResultSet.
 
Methods inherited from class org.jpox.store.extent.AbstractExtent
close, closeAll, getCandidateClass, getFetchPlan, getPersistenceManager, hasSubclasses, iterator, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

LOCALISER_RDBMS

protected static final Localiser LOCALISER_RDBMS
Localised messages

Constructor Detail

ClassTableExtent

public ClassTableExtent(PersistenceManager pm,
                        DatastoreClass table,
                        java.lang.Class cls,
                        boolean subclasses)
Constructor. Used for classes that have "new-table" or "superclass-table" inheritance strategies.

Parameters:
pm - PersistenceManager
table - Table representing the class whose extent we want
cls - Candidate class
subclasses - Whether to include subclasses of the class.

ClassTableExtent

public ClassTableExtent(PersistenceManager pm,
                        DatastoreClass[] tables,
                        java.lang.Class cls,
                        boolean subclasses)
Constructor. Used for classes that have "subclass-table" inheritance strategy, and hence can be persisted into multiple tables.

Parameters:
pm - PersistenceManager
tables - Tables representing the class whose extent we want
cls - Candidate class
subclasses - Whether to include subclasses of the class.
Method Detail

newQueryStatement

public QueryExpression newQueryStatement()
Create a new query to search for the candidate classes etc.

Specified by:
newQueryStatement in interface Queryable
Returns:
The new QueryStatement.

newQueryStatement

public QueryExpression newQueryStatement(java.lang.Class candidateClass)
Create a query to search for instances of the candidateClass and its subclasses (if required).

Specified by:
newQueryStatement in interface Queryable
Parameters:
candidateClass - The candidate class
Returns:
The QueryStatement that will return the instances
See Also:
Queryable.newQueryStatement()

newResultObjectFactory

public Query.ResultObjectFactory newResultObjectFactory(QueryExpression stmt,
                                                        boolean ignoreCache,
                                                        java.lang.Class resultClass,
                                                        boolean useFetchPlan)
Create a new factory for objects from the ResultSet.

Specified by:
newResultObjectFactory in interface Queryable
Parameters:
stmt - The Query Statement
ignoreCache - Whether to ignore dirty objects
resultClass - Whether to create objects of a particular class
useFetchPlan - whether to use the fetch plan to retrieve fields in the same query
Returns:
The result object factory

isEmpty

public boolean isEmpty()
Returns true if this collection contains no elements.

Specified by:
isEmpty in interface Queryable
Returns:
Whether the extent has no elements.


Copyright © -2007 . All Rights Reserved.