| Summary: | QueryHints.BATCH queries are not (always) executed if there is a FetchType.Lazy annotation value on the collection | ||
|---|---|---|---|
| Product: | z_Archived | Reporter: | Martin Marinschek <martin.marinschek> |
| Component: | Eclipselink | Assignee: | Project Inbox <eclipselink.orm-inbox> |
| Status: | CLOSED INVALID | QA Contact: | |
| Severity: | normal | ||
| Priority: | P2 | CC: | jamesssss, tom.ware |
| Version: | unspecified | ||
| Target Milestone: | --- | ||
| Hardware: | PC | ||
| OS: | Windows XP | ||
| Whiteboard: | |||
Where are you expecting to see the batch query? On the initial call, or when the LAZY relationship is triggered? Batch queries should run when the relationship is triggered. For EAGER relationships that will be right away, but for LAZY relationships, it will occur when the relationship is first traversed. Setting target and priority. See the following page for the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Community: Please vote for this bug if it is important to you. Votes are one of the main criteria we use to determine which bugs to fix next. No, batch fetching supports LAZY. If you want the relationships instantiated, the specify a LoadGroup. The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: 2.2.1 See the following code: ForeignReferenceMapping#batchedValueFromRow: protected Object batchedValueFromRow(AbstractRecord row, ObjectLevelReadQuery query, CacheKey parentCacheKey) { ReadQuery batchQuery = (ReadQuery)query.getProperty(this); if (batchQuery == null) { if (query.hasBatchReadAttributes()) { Map<DatabaseMapping, ReadQuery> queries = query.getBatchFetchPolicy().getMappingQueries(); if (queries != null) { batchQuery = queries.get(this); } } if (batchQuery == null) { batchQuery = prepareNestedBatchQuery(query); batchQuery.setIsExecutionClone(true); } else { batchQuery = (ReadQuery)batchQuery.clone(); batchQuery.setIsExecutionClone(true); } query.setProperty(this, batchQuery); } return this.indirectionPolicy.valueFromBatchQuery(batchQuery, row, query, parentCacheKey); } this references the indirection-policy for this mapping. Depending on the annotations, this indirection-policy might be set for lazy fetching. However, if I specify a Batch QueryHint, my assumption would be that the batch is always executed, and the annotations are disregarded. Reproducible: Always