public class BulkFetchExistsHandler extends Object implements BulkFetchHandler
In simple terms if we have a query with resultant SQL like
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 |
---|
BulkFetchExistsHandler() |
Modifier and Type | Method and Description |
---|---|
IteratorStatement |
getStatementToBulkFetchField(org.datanucleus.metadata.AbstractClassMetaData candidateCmd,
org.datanucleus.metadata.AbstractMemberMetaData mmd,
org.datanucleus.store.query.Query query,
Map parameters,
RDBMSQueryCompilation datastoreCompilation,
Set<String> mapperOptions)
Convenience method to generate a bulk-fetch statement for the specified multi-valued field of the owning query.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
applyParametersToStatement
public IteratorStatement getStatementToBulkFetchField(org.datanucleus.metadata.AbstractClassMetaData candidateCmd, org.datanucleus.metadata.AbstractMemberMetaData mmd, org.datanucleus.store.query.Query query, Map parameters, RDBMSQueryCompilation datastoreCompilation, Set<String> mapperOptions)
getStatementToBulkFetchField
in interface BulkFetchHandler
candidateCmd
- Metadata for the candidateparameters
- Parameters for the querymmd
- Metadata for the multi-valued fielddatastoreCompilation
- The datastore compilation of the querymapperOptions
- Any options for the query to SQL mapperquery
- The queryCopyright © 2019. All rights reserved.