Package org.datanucleus.store.rdbms.sql
Class AbstractSelectStatementGenerator
- java.lang.Object
-
- org.datanucleus.store.rdbms.sql.AbstractSelectStatementGenerator
-
- All Implemented Interfaces:
SelectStatementGenerator
- Direct Known Subclasses:
DiscriminatorStatementGenerator,UnionStatementGenerator
public abstract class AbstractSelectStatementGenerator extends java.lang.Object implements SelectStatementGenerator
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
Fields Modifier and Type Field Description protected DatastoreClasscandidateTableTable where the candidate objects are stored.protected DatastoreIdentifiercandidateTableAliasAlias for the candidate table in the SQL statement.protected java.lang.StringcandidateTableGroupNameName of the table-group to use for the candidate(s) (optional, see SQLStatement).protected java.lang.ClasscandidateTypeCandidate type to query.protected org.datanucleus.ClassLoaderResolverclrClassLoader resolver.protected booleanincludeSubclassesWhether to include iteration through subclasses of the candidate.(package private) JavaTypeMappingjoinElementMappingMapping in join table to join to the element.(package private) TablejoinTableJoin table for the case where we are selecting the join table and returning elements.(package private) DatastoreIdentifierjoinTableAliasIdentifier for any join table (optional).(package private) java.util.Set<java.lang.String>optionsSelected options controlling the generation of the SQL statement.protected SQLStatementparentStmtParent statement.protected RDBMSStoreManagerstoreMgrManager for the datastore.-
Fields inherited from interface org.datanucleus.store.rdbms.sql.SelectStatementGenerator
OPTION_ALLOW_NULLS, OPTION_DONT_RESTRICT_DISCRIM, OPTION_INCLUDE_SOFT_DELETES, OPTION_RESTRICT_DISCRIM, OPTION_SELECT_DN_TYPE
-
-
Constructor Summary
Constructors Constructor Description AbstractSelectStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, java.lang.Class candidateType, boolean subclasses, DatastoreIdentifier candidateTableAlias, java.lang.String candidateTableGroupName)Constructor for the case where we select the candidate table.AbstractSelectStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, java.lang.Class candidateType, boolean subclasses, DatastoreIdentifier candidateTableAlias, java.lang.String candidateTableGroupName, Table joinTable, DatastoreIdentifier joinTableAlias, JavaTypeMapping joinElementMapping)Constructor for the case where we select the join table and join to the candidate table.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanhasOption(java.lang.String name)Whether the generator has a particular option set.SelectStatementGeneratorsetOption(java.lang.String name)Method to set a property.SelectStatementGeneratorunsetOption(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.SelectStatementGenerator
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 java.lang.Class candidateType
Candidate type to query.
-
includeSubclasses
protected final boolean includeSubclasses
Whether to include iteration through subclasses of the candidate.
-
candidateTable
protected DatastoreClass candidateTable
Table where the candidate objects are stored.
-
candidateTableAlias
protected 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).
-
joinTable
Table joinTable
Join table for the case where we are selecting the join table and returning elements.
-
joinTableAlias
DatastoreIdentifier joinTableAlias
Identifier for any join table (optional).
-
joinElementMapping
JavaTypeMapping joinElementMapping
Mapping in join table to join to the element.
-
options
java.util.Set<java.lang.String> options
Selected options controlling the generation of the SQL statement.
-
-
Constructor Detail
-
AbstractSelectStatementGenerator
public AbstractSelectStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, java.lang.Class candidateType, boolean subclasses, DatastoreIdentifier candidateTableAlias, java.lang.String candidateTableGroupName)
Constructor for the case where we select the candidate table.- Parameters:
storeMgr- Store Managerclr- ClassLoader resolvercandidateType- Candidate root typesubclasses- Whether to include subclassescandidateTableAlias- Alias for the candidate (optional)candidateTableGroupName- Name of the table group for the candidate(s) (optional)
-
AbstractSelectStatementGenerator
public AbstractSelectStatementGenerator(RDBMSStoreManager storeMgr, org.datanucleus.ClassLoaderResolver clr, java.lang.Class candidateType, boolean subclasses, DatastoreIdentifier candidateTableAlias, java.lang.String candidateTableGroupName, Table joinTable, DatastoreIdentifier joinTableAlias, JavaTypeMapping joinElementMapping)
Constructor for the case where we select the join table and join to the candidate table.- Parameters:
storeMgr- Store Managerclr- ClassLoader resolvercandidateType- Candidate root typesubclasses- Whether to include subclassescandidateTableAlias- Alias for the candidate (optional)candidateTableGroupName- Name of the table group for the candidate(s) (optional)joinTable- Join tablejoinTableAlias- Alias for the join tablejoinElementMapping- Mapping to the candidate from the join table
-
-
Method Detail
-
setOption
public SelectStatementGenerator setOption(java.lang.String name)
Description copied from interface:SelectStatementGeneratorMethod to set a property.- Specified by:
setOptionin interfaceSelectStatementGenerator- Parameters:
name- Name of the property- Returns:
- This generator
-
unsetOption
public SelectStatementGenerator unsetOption(java.lang.String name)
Description copied from interface:SelectStatementGeneratorMethod to unset a property.- Specified by:
unsetOptionin interfaceSelectStatementGenerator- Parameters:
name- Name of the property- Returns:
- This generator
-
hasOption
public boolean hasOption(java.lang.String name)
Description copied from interface:SelectStatementGeneratorWhether the generator has a particular option set.- Specified by:
hasOptionin interfaceSelectStatementGenerator- Parameters:
name- Name of the option- Returns:
- Whether it is set
-
-