|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.datanucleus.store.rdbms.sql.AbstractStatementGenerator
org.datanucleus.store.rdbms.sql.DiscriminatorStatementGenerator
public class DiscriminatorStatementGenerator
Class to generate an SQLStatement for iterating through instances of a particular type (and optionally subclasses). Based around the candidate type having subclasses the candidate has a discriminator column, and so can be used as the way of determining the type of the object. Also allows select of the discriminator column to allow retrieval of the type of the object. Please refer to the specific constructors for the usages. Note that the statement returned by getStatement() has nothing selected, solely providing the basic structure. Column selection should be performed when generating the mapping definition.
This generator supports the following "options" :-
| Field Summary |
|---|
| Fields inherited from class org.datanucleus.store.rdbms.sql.AbstractStatementGenerator |
|---|
candidateTable, candidateTableAlias, candidateTableGroupName, candidateType, clr, includeSubclasses, parentStmt, storeMgr |
| Fields inherited from interface org.datanucleus.store.rdbms.sql.StatementGenerator |
|---|
OPTION_ALLOW_NULLS, OPTION_RESTRICT_DISCRIM, OPTION_SELECT_NUCLEUS_TYPE |
| Constructor Summary | |
|---|---|
DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class[] candidateTypes,
boolean includeSubclasses,
org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
String candidateTableGroupName)
Constructor, using the candidateTable as the primary table of the SQL SELECT. |
|
DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class[] candidateTypes,
boolean includeSubclasses,
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, using the joinTable as the primary table of the SQL SELECT and joining to the table of the candidate(s). |
|
DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class candidateType,
boolean includeSubclasses,
org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
String candidateTableGroupName)
Constructor, using the candidateTable as the primary table of the SQL SELECT. |
|
DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class candidateType,
boolean includeSubclasses,
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, using the joinTable as the primary table of the SQL SELECT and joining to the table of the candidate. |
|
| Method Summary | |
|---|---|
SQLStatement |
getStatement()
Accessor for the SQL Statement. |
void |
setParentStatement(SQLStatement stmt)
Method to set the parent statement. |
| Methods inherited from class org.datanucleus.store.rdbms.sql.AbstractStatementGenerator |
|---|
hasOption, setOption, unsetOption |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class candidateType,
boolean includeSubclasses,
org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
String candidateTableGroupName)
SELECT
FROM A T0
[WHERE (T0.DISCRIMINATOR = A0value || T0.DISCRIMINATOR = A1value ||
T0.DISCRIMINATOR = A2value || T0.DISCRIMINATOR = A3value ||
T0.DISCRIMINATOR = A4value)]
The "candidateType" will provide the primary table of the SQL SELECT.
storeMgr - Manager for the datastoreclr - ClassLoader resolvercandidateType - Base object type that we are looking forincludeSubclasses - Should we include subclasses of this candidate?candidateTableAlias - Alias to use for the candidate table (optional)candidateTableGroupName - Name of the table group for the candidate(s) (optional)
public DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class[] candidateTypes,
boolean includeSubclasses,
org.datanucleus.store.mapped.DatastoreIdentifier candidateTableAlias,
String candidateTableGroupName)
storeMgr - Manager for the datastoreclr - ClassLoader resolvercandidateTypes - Base object type(s) that we are looking forincludeSubclasses - Should we include subclasses of this candidate(s)?candidateTableAlias - Alias to use for the candidate table (optional)candidateTableGroupName - Name of the table group for the candidate(s) (optional)
public DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class candidateType,
boolean includeSubclasses,
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)
SELECT
FROM A_B T0
INNER JOIN B T1 ON T1.B_ID = A_B.B_ID_EID
[WHERE (T1.DISCRIMINATOR = B0value || T1.DISCRIMINATOR = B1value ||
T1.DISCRIMINATOR = B2value || T1.DISCRIMINATOR = B3value ||
T1.DISCRIMINATOR = B4value)]
The join table will provide the primary table of the SQL SELECT.
The join is INNER JOIN when no nulls are allowed in the collection, and LEFT OUTER JOIN
when it allows nulls.
storeMgr - Manager for the datastorecandidateType - Base object type(s) that we are looking forincludeSubclasses - Should we include subclasses of this candidate?candidateTableAlias - Alias to use for the candidate table (optional)candidateTableGroupName - Name of the table group for the candidate(s) (optional)joinTable - Join table linking owner to elementsjoinTableAlias - any alias to use for the join table in the SQLjoinElementMapping - Mapping in the join table to link to the element
public DiscriminatorStatementGenerator(RDBMSStoreManager storeMgr,
org.datanucleus.ClassLoaderResolver clr,
Class[] candidateTypes,
boolean includeSubclasses,
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)
storeMgr - Manager for the datastoreclr - ClassLoader resolvercandidateTypes - Base object type(s) that we are looking forincludeSubclasses - Should we include subclasses of this candidate?candidateTableAlias - Alias to use for the candidate table (optional)candidateTableGroupName - Name of the table group for the candidate(s) (optional)joinTable - Join table linking owner to elementsjoinTableAlias - any alias to use for the join table in the SQLjoinElementMapping - Mapping in the join table to link to the element| Method Detail |
|---|
public void setParentStatement(SQLStatement stmt)
StatementGenerator
stmt - The parent statementpublic SQLStatement getStatement()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||