| Summary: | EL 2.1.0 JPA: Query with hint eclipselink.batch and org.eclipse.persistence.exceptions.QueryException.queryHintNavigatedNonExistantRelationship | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Michael Braeuer <michael.braeuer> | ||||||
| Component: | Eclipselink | Assignee: | Tom Ware <tom.ware> | ||||||
| Status: | CLOSED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P2 | CC: | corteggiano, eclipselink.orm-inbox, michael.braeuer, peter.krogh, tom.ware | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | --- | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | submitted_patch | ||||||||
| Attachments: |
|
||||||||
Created attachment 174613 [details]
Tescase for reproducing problem.
In order to create schema use DropAndCreate.sql in Oracle DB.
Adjust persistence.xml
I filed a similar bug (320446) with details of the faulty code at EclipseLink 2.1 source code. Setting target and priority. See the following page for details of the meanings of these fields: http://wiki.eclipse.org/EclipseLink/Development/Bugs/Guidelines Created attachment 179076 [details] proposed patch The patch just realizes what was indicated in Bug 320446 by corteggiano@gmail.com *** Bug 320446 has been marked as a duplicate of this bug. *** Checked in fix with an additional null check Added test to EntityManagerJunitTestSuite Tested with JPA LRG setting iplog flag on patch Fix backported to 2.1.3 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.1.0.v20100614-r7608 When using a batch hint navigating along a relationship in a JPQL Query an exception is thrown. Application code: ... EntityManagerFactory emf = Persistence .createEntityManagerFactory("EL-05-ELPerformance"); EntityManager em = emf.createEntityManager(); List<PurchaseOrder> pos = (List<PurchaseOrder>) em .createQuery( "SELECT po FROM PurchaseOrder po WHERE po.status = 'ACTIVE' AND po.customer.address.city = 'SFO'") .setHint("eclipselink.join-fetch", "po.customer") .setHint("eclipselink.join-fetch", "po.customer.address") .setHint("eclipselink.batch", "po.customer.phoneNumbers") .getResultList(); ... Exception: Exception in thread "main" Local Exception Stack: Exception [EclipseLink-6143] (Eclipse Persistence Services - 2.1.0.v20100614-r7608): org.eclipse.persistence.exceptions.QueryException Exception Description: The value po.customer.phoneNumbers supplied to the query hint eclipselink.batch navigated a non-existant relationship. The relationship customer.phoneNumbers does not exist. Query: ReadAllQuery(referenceClass=PurchaseOrder sql="SELECT t0.ID, t0.STATUS, t0.CUST_ID FROM PO t0, CUST t2, ADDR t1 WHERE (((t0.STATUS = ?) AND (t1.CITY = ?)) AND ((t2.ID = t0.CUST_ID) AND (t1.ID = t2.ADDR_ID)))") at org.eclipse.persistence.exceptions.QueryException.queryHintNavigatedNonExistantRelationship(QueryException.java:1327) at org.eclipse.persistence.internal.jpa.QueryHintsHandler$BatchHint.applyToDatabaseQuery(QueryHintsHandler.java:1198) at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:345) at org.eclipse.persistence.internal.jpa.QueryHintsHandler$Hint.apply(QueryHintsHandler.java:323) at org.eclipse.persistence.internal.jpa.QueryHintsHandler.apply(QueryHintsHandler.java:163) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHintInternal(EJBQueryImpl.java:962) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHint(EJBQueryImpl.java:944) at org.eclipse.persistence.internal.jpa.EJBQueryImpl.setHint(EJBQueryImpl.java:73) at tester.EntityTester.main(EntityTester.java:26) Relationship exists in metamodel and it works with build 2.0.2.v20100323-r6872. Reproducible: Always Steps to Reproduce: 1. use uploaded eclipse project. 2. run EntityTester.java