public class BulkFetchHelper extends Object
SELECT COL1, COL2, COL3, ... FROM CANDIDATE_TBL T1 WHERE T1.COL2 = valuethen to retrieve a multi-valued collection field of the candidate class it generates an SQL like
SELECT ELEM.COL1, ELEM.COL2, ... FROM ELEMENT_TBL ELEM WHERE EXISTS ( SELECT T1.ID FROM CANDIDATE_TBL T1 WHERE T1.COL2 = value AND ELEM.OWNER_ID = T1.ID)Obviously there are differences when using a join-table, or when the elements are embedded into the join-table, but the basic idea is we generate an iterator statement for the elements (just like the backing store normally would) except instead of restricting the statement to just a particular owner, it adds an EXISTS clause with the query as the exists subquery).
| Constructor and Description | 
|---|
BulkFetchHelper(org.datanucleus.store.query.Query q)  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
applyParametersToStatement(PreparedStatement ps,
                          RDBMSQueryCompilation datastoreCompilation,
                          SQLStatement sqlStmt,
                          Map parameters)
Convenience method to apply the passed parameters to the provided bulk-fetch statement. 
 | 
IteratorStatement | 
getSQLStatementForContainerField(org.datanucleus.metadata.AbstractClassMetaData candidateCmd,
                                Map parameters,
                                org.datanucleus.metadata.AbstractMemberMetaData mmd,
                                RDBMSQueryCompilation datastoreCompilation)
Convenience method to generate a bulk-fetch statement for the specified multi-valued field of the owning query. 
 | 
public IteratorStatement getSQLStatementForContainerField(org.datanucleus.metadata.AbstractClassMetaData candidateCmd, Map parameters, org.datanucleus.metadata.AbstractMemberMetaData mmd, RDBMSQueryCompilation datastoreCompilation)
candidateCmd - Metadata for the candidateparameters - Parameters for the querymmd - Metadata for the multi-valued fielddatastoreCompilation - The datastore compilation of the querypublic void applyParametersToStatement(PreparedStatement ps, RDBMSQueryCompilation datastoreCompilation, SQLStatement sqlStmt, Map parameters)
ps - PreparedStatementdatastoreCompilation - The datastore compilation for the query itselfsqlStmt - The bulk-fetch iterator statementparameters - The map of parameters passed in to the queryCopyright © 2015. All rights reserved.