Summary: | IndexOutOfBoundsException with nested left join fetches defined through orm.xml hints | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Product: | z_Archived | Reporter: | Gonzalo Peche <gpeche> | ||||||||
Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||||||
Status: | NEW --- | QA Contact: | |||||||||
Severity: | normal | ||||||||||
Priority: | P3 | CC: | cen.is.imba, kohei.nozaki, miklos, radek.felcman | ||||||||
Version: | unspecified | Keywords: | vm | ||||||||
Target Milestone: | --- | ||||||||||
Hardware: | All | ||||||||||
OS: | All | ||||||||||
Whiteboard: | |||||||||||
Attachments: |
|
Description
Gonzalo Peche
2015-03-10 07:47:37 EDT
I got exact same error but using setHint in code. The problem is that I used Map<Object, String> as initial storage for hints and iterated over it, calling setHint on each entry. My guess is that EclipseLink stores references to hints therefore I got exact same error as described here. Perhaps it would be safer if it made internal copies. Created attachment 285685 [details]
Maven projects and test cases to support 2.4.2 version
Small changes added to Gonzalo Peche's maven projects and test cases to support 2.4.2 version and also I have checked the 2.6.9 as well. The problem appears in all theese three versions and not only with orm.xml but when QueryHints added to named queries as well.
Many thanks to Gonzalo Peche for the patch given in a maven test project. I have downloaded and tested with diffeent eclipselink versions. The problem solved by this patch which still exists in the 2.6.9 version as well when running in a Java 8 environment. I have attached my modified maven project. I had to change just a small thing in the original JPQL query to support the older 2.4.2 as well. In my case it was not enough just patching the NamedQueryMetadata but also the JoinedAttributeManager as well. I had no enough time to analyze this case. It was a big help to me because I have to migrate our glassfish 3.1 application from Java 7 to Java 8. First I have upgraded the eclipselink version using the official OSGI package from 2.3 to 2.4 then I have realized the situation so I had to repair it. I am going to visit the latest 2.7.x and 3.0.x versions as well. Created attachment 287777 [details]
Maven project with 2.7.4 support for testing
I had to do one more step because I want to use the Eclipse supported GlassFish 5.1.0 application server with JavaEE 8 features. And I have faced with the same problem again after a year.
It uses the eclipselink 2.7.4 version so I had to add to the example project some small modification to support 2.7.4 wich has signed jars so I had to include the javax.persistence artifact as well before the eclipselink artifact itself in the pom (this was the only workaround).
With this test I could verify that Gonzalo Peche patch works for this version as well. And based on the result I have modified the two osgi jar file with the newly compiled two patched java classes (core and jpa library) in the Glassfish modules folder.
And now my application works in GlassFish 5.1.0 as well.
This patch is required because I am using @QueryHint annotation in many @NamedQuery definitions. And the problem still exists with JDK 8. Right now I do not want to change this approach in all places in my project into the explicit query.setHint() method calls wich works without any patch as Gonzalo mentioned as well.
I hope that this problem is also important for many others and probably soon it will be appear a final accepted and approved solution in a published future version as well.
Additional bug and bugfix for master, 3.0, 2.7 branches https://github.com/eclipse-ee4j/eclipselink/issues/1148 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 |