Community
Participate
Working Groups
Build Identifier: 2.3.2.v20111125-r10461 I have model like this: SignOff *-> Control <-1 Responsibility 1-> Unit When I create an object graph where there is one SignOff related to one Control that has two Responsibilities each with a unique Unit, and execute the following query SELECT s FROM SignOff s WHERE s.control.id = :controlId with the following query hints eclipselink.join-fetch = s.control eclipselink.join-fetch = s.control.responsibilities eclipselink.join-fetch = s.control.responsibilities.unit then I get a Control whose both Responsibilities wrongly point to the same Unit instead of the two unique ones. A workaround is to use only one query hint: eclipselink.join-fetch = s.control.responsibilities.unit but this makes me wonder if corrupted entities might be generate in other cases as well. Reproducible: Always Steps to Reproduce: 1. Run the provided test cases (Maven project, JUnit)
Created attachment 208287 [details] test cases
I encounter the same problem. It seems it might be related to applying join-fetch hints that share the beginning of the path. I have a hierarchy like this: A <-* B (in A I have List<B> children) B <-* C (in B I have List<C> childrenC) B <-* D (in B I have List<D> childrenD) I have the query select a from A a Each of the following hints work separately: qFetch.setHint(QueryHints.LEFT_FETCH, "a.children.childrenC") qFetch.setHint(QueryHints.FETCH, "a.children.childrenD"); However, they do not work together. I have attached a test case.
Created attachment 208310 [details] Test case for multiple join fetch
I'm sorry for a small typo, both hints are QueryHints.FETCH: qFetch.setHint(QueryHints.FETCH, "a.children.childrenC"); qFetch.setHint(QueryHints.FETCH, "a.children.childrenD");
I have investigated by myself this problem, and found it to reside in JoinedAttributeManager, method prepareJoinExpressions. There is a declaration in that method: List groupedExpressionList = new ArrayList(getJoinedAttributeExpressions().size()); For the test case I described, there will be 4 expressions added through this line of code: this.setJoinedAttributeExpressions_(groupedExpressionList); The 4 expressions correspond to: 1. a.children 2. a.children.childrenC 3. a.children 4. a.children.childrenD By hacking the "groupedExpressionList" and turning it into a Set, everything seems to work fine. HTH
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.
Created attachment 214897 [details] Suggested patch - defined new versions of anyOf and anyOfAllowingNone methods taking boolean parameter that indicates whether to create a new expression or return existing one (the pattern of get and getAllowingNull methods); - copied into FETCH processing ObjectAggregateMapping's handling from LEFT_FETCH. Test: EntityManagerJUnitTestSuite.testNestedFetchQueryHints
Created attachment 214940 [details] Suggested patch + batch test Added to the previous patch a new test EntityManagerJUnitTestSuite.testNestedBatchQueryHints to verify nested batching.
Checked the patch into both trunk (2.4) and 2.3.3. Reviewed by James.
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink