/jdo-bulkfetch-collection

Example of using JDO API with Bulk Fetch of a collection of persistables

Primary LanguageJava

jdo-bulkfetch-collection

Example of using a query to bulk fetch a field that contains a collection of persistables.

To run this, simply type "mvn clean test".

The test creates some data, and then does a single JDOQL query fetch, with the Collection field in the DFG. This results in SQL of

SELECT 'mydomain.model.A' AS DN_TYPE,A0.ID,A0."NAME" FROM A A0


SELECT 'mydomain.model.B' AS DN_TYPE,A1.ID,A1."NAME",A0.ID_OID,A0.IDX AS NUCORDER0 
FROM A_BS A0 INNER JOIN B A1 ON A0.ID_EID = A1.ID 
WHERE A0.IDX >= 0 AND EXISTS 
    (SELECT 'mydomain.model.A' AS DN_TYPE,A0_SUB.ID AS DN_APPID 
     FROM A A0_SUB 
     WHERE A0.ID_OID = A0_SUB.ID) ORDER BY NUCORDER0

So one SQL for the query candidate and a single SQL for the collection field (for all candidates)