Class BulkFetchJoinHandler
- java.lang.Object
-
- org.datanucleus.store.rdbms.query.BulkFetchJoinHandler
-
- All Implemented Interfaces:
BulkFetchHandler
public class BulkFetchJoinHandler extends Object implements BulkFetchHandler
Helper class to generate the necessary statement for multi-valued field bulk-fetch, using JOIN semantics.In simple terms if we have a query with resultant SQL like
SELECT COL1, COL2, COL3, ... FROM CANDIDATE_TBL T1 WHERE T1.COL2 = value
then to retrieve a multi-valued collection field of the candidate class it generates an SQL likeSELECT ELEM.COL1, ELEM.COL2, ... FROM CANDIDATE_TBL T1, ELEMENT_TBL ELEM WHERE ELEM.CAND_ID = T1.ID AND T1.COL2 = value
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 a JOIN, restricting to the candidates implied by the query This is work-in-progress
-
-
Constructor Summary
Constructors Constructor Description BulkFetchJoinHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Method Detail
-
getStatementToBulkFetchField
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)
Convenience method to generate a bulk-fetch statement for the specified multi-valued field of the owning query.- Specified by:
getStatementToBulkFetchField
in interfaceBulkFetchHandler
- Parameters:
candidateCmd
- Metadata for the candidatemmd
- Metadata for the member we are bulk-fetching the value(s) forquery
- The queryparameters
- Parameters for the querydatastoreCompilation
- The datastore compilation of the querymapperOptions
- Any mapper options for query generation- Returns:
- The statement to use for bulk fetching, together with mappings for extracting the results of the elements
-
-