Community
Participate
Working Groups
Build Identifier: 2.3.1.v20111014-r10236 As described in "NullPointerException in Query.setHint with join-fetch/batch" (http://www.eclipse.org/forums/index.php/t/262488) a NullPointerException occurs while using Query.setHint on a named query with join-fetch/batch. The code performing the query looks like: Query query = em.createNamedQuery(Container.LOAD_BY_ORDER); query.setParameter("orderId", id); query.setHint(QueryHints.FETCH, "c.attribute1"); query.setHint(QueryHints.BATCH, "c.attribute3"); List result = query.getResultList(); The application uses EclipseLink 3.2.1 M8 and is hosted on WebSphere Application Server 7.0 FP17 on an AIX system. The query is concurrently performed by message driven beans. After one failure all subsequent calls fail with the same exception until the server is restarted. It should be possible to execute the code above concurrently without getting a NullPointerException. Reproducible: Sometimes Steps to Reproduce: Concurrent calls of Query.setHint on named query with join-fetch/batch.
Created attachment 207346 [details] Stacktrace of NullPointerException
Please describe the level of concurrency (i.e. what is shared between threads?) Is it the EntityManager? The EntityManagerFactory? The query?
(In reply to comment #2) > Please describe the level of concurrency (i.e. what is shared between threads?) > > Is it the EntityManager? The EntityManagerFactory? The query? The application (stateful session bean) shares none of these. James in http://www.eclipse.org/forums/index.php/mv/msg/262488/758040/#msg_758040 > The issue is although the hint causes different queries to be used, the same expression is still used, causing the concurrency issue. As far as I understood James in the related post the expression of the named query is internally shared between threads.
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 212173 [details] Suggested patch (for trunk)
The patched checked into both trunk and 2.3.3.
Created attachment 212300 [details] Test fix - the test should not run on app. server
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink