org.datanucleus.store.rdbms.sql
Class AbstractStatementGenerator

java.lang.Object
  extended by org.datanucleus.store.rdbms.sql.AbstractStatementGenerator
All Implemented Interfaces:
StatementGenerator
Direct Known Subclasses:
DiscriminatorStatementGenerator, UnionStatementGenerator

public abstract class AbstractStatementGenerator
extends Object
implements StatementGenerator

Abstract generator of SQLStatements. Based around a candidate(s) and optionally including subclasses. If the candidate type has no table of its own (using "subclass-table") and there isn't a single subclass with its own table then throws a NucleusException since there is no root table to select. Accepts options controlling the generation of the SQL.


Field Summary
protected  org.datanucleus.store.mapped.DatastoreClass candidateTable
          Table where the candidate objects are stored.
protected  org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias
          Alias for the candidate table in the SQL statement.
protected  String candidateTableGroupName
          Name of the table-group to use for the candidate(s) (optional, see SQLStatement).
protected  Class candidateType
          Candidate type to query.
protected  org.datanucleus.ClassLoaderResolver clr
          ClassLoader resolver.
protected  boolean includeSubclasses
          Whether to include iteration through subclasses of the candidate.
protected  SQLStatement parentStmt
          Parent statement.
protected  RDBMSStoreManager storeMgr
          Manager for the datastore.
 
Fields inherited from interface org.datanucleus.store.rdbms.sql.StatementGenerator
OPTION_ALLOW_NULLS, OPTION_RESTRICT_DISCRIM, OPTION_SELECT_NUCLEUS_TYPE
 
Constructor Summary
AbstractStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, Class candidateType, boolean subclasses, org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias, String candidateTableGroupName)
          Constructor for the case where we select the candidate table.
AbstractStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, Class candidateType, boolean subclasses, org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias, String candidateTableGroupName, org.datanucleus.store.mapped.DatastoreContainerObject joinTable, org.datanucleus.store.mapped.DatastoreIdentifier joinTableAlias, org.datanucleus.store.mapped.mapping.JavaTypeMapping joinElementMapping)
          Constructor for the case where we select the join table and join to the candidate table.
 
Method Summary
 boolean hasOption(String name)
          Whether the generator has a particular option set.
 StatementGenerator setOption(String name)
          Method to set a property.
 StatementGenerator unsetOption(String name)
          Method to unset a property.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.datanucleus.store.rdbms.sql.StatementGenerator
getStatement, setParentStatement
 

Field Detail

storeMgr

protected final RDBMSStoreManager storeMgr
Manager for the datastore.


clr

protected final org.datanucleus.ClassLoaderResolver clr
ClassLoader resolver.


parentStmt

protected SQLStatement parentStmt
Parent statement.


candidateType

protected Class candidateType
Candidate type to query.


includeSubclasses

protected final boolean includeSubclasses
Whether to include iteration through subclasses of the candidate.


candidateTable

protected org.datanucleus.store.mapped.DatastoreClass candidateTable
Table where the candidate objects are stored.


candidateTableAlias

protected org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias
Alias for the candidate table in the SQL statement.


candidateTableGroupName

protected String candidateTableGroupName
Name of the table-group to use for the candidate(s) (optional, see SQLStatement).

Constructor Detail

AbstractStatementGenerator

public AbstractStatementGenerator(RDBMSStoreManager storeMgr,
                                  org.datanucleus.ClassLoaderResolver clr,
                                  Class candidateType,
                                  boolean subclasses,
                                  org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
                                  String candidateTableGroupName)
Constructor for the case where we select the candidate table.

Parameters:
storeMgr - Store Manager
clr - ClassLoader resolver
candidateType - Candidate root type
subclasses - Whether to include subclasses
candidateTableAlias - Alias for the candidate (optional)
candidateTableGroupName - Name of the table group for the candidate(s) (optional)

AbstractStatementGenerator

public AbstractStatementGenerator(RDBMSStoreManager storeMgr,
                                  org.datanucleus.ClassLoaderResolver clr,
                                  Class candidateType,
                                  boolean subclasses,
                                  org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
                                  String candidateTableGroupName,
                                  org.datanucleus.store.mapped.DatastoreContainerObject joinTable,
                                  org.datanucleus.store.mapped.DatastoreIdentifier joinTableAlias,
                                  org.datanucleus.store.mapped.mapping.JavaTypeMapping joinElementMapping)
Constructor for the case where we select the join table and join to the candidate table.

Parameters:
storeMgr - Store Manager
clr - ClassLoader resolver
candidateType - Candidate root type
subclasses - Whether to include subclasses
candidateTableAlias - Alias for the candidate (optional)
candidateTableGroupName - Name of the table group for the candidate(s) (optional)
joinTable - Join table
joinTableAlias - Alias for the join table
joinElementMapping - Mapping to the candidate from the join table
Method Detail

setOption

public StatementGenerator setOption(String name)
Description copied from interface: StatementGenerator
Method to set a property.

Specified by:
setOption in interface StatementGenerator
Parameters:
name - Name of the property

unsetOption

public StatementGenerator unsetOption(String name)
Description copied from interface: StatementGenerator
Method to unset a property.

Specified by:
unsetOption in interface StatementGenerator
Parameters:
name - Name of the property

hasOption

public boolean hasOption(String name)
Description copied from interface: StatementGenerator
Whether the generator has a particular option set.

Specified by:
hasOption in interface StatementGenerator
Parameters:
name - Name of the option
Returns:
Whether it is set


Copyright © 2012. All Rights Reserved.