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 java.lang.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  java.lang.String candidateTableGroupName
          Name of the table-group to use for the candidate(s) (optional, see SQLStatement).
protected  java.lang.Class candidateType
          Candidate type to query.
protected  boolean includeSubclasses
          Whether to include iteration through subclasses of the candidate.
protected  RDBMSManager storeMgr
          Manager for the datastore.
 
Constructor Summary
AbstractStatementGenerator(RDBMSManager storeMgr, java.lang.Class candidateType, boolean subclasses, org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias, java.lang.String candidateTableGroupName)
          Constructor for the case where we select the candidate table.
AbstractStatementGenerator(RDBMSManager storeMgr, java.lang.Class candidateType, boolean subclasses, org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias, java.lang.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(java.lang.String name)
          Whether the generator has a particular option set.
 StatementGenerator setOption(java.lang.String name)
          Method to set a property.
 StatementGenerator unsetOption(java.lang.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
 

Field Detail

storeMgr

protected final RDBMSManager storeMgr
Manager for the datastore.


candidateType

protected java.lang.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 java.lang.String candidateTableGroupName
Name of the table-group to use for the candidate(s) (optional, see SQLStatement).

Constructor Detail

AbstractStatementGenerator

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

Parameters:
storeMgr - Store Manager
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(RDBMSManager storeMgr,
                                  java.lang.Class candidateType,
                                  boolean subclasses,
                                  org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
                                  java.lang.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
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(java.lang.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(java.lang.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(java.lang.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 © 2009. All Rights Reserved.