Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 357344

Summary: Cursor result with JPA query and dynamic fetch group
Product: z_Archived Reporter: attila Mising name <mathe_attila>
Component: EclipselinkAssignee: Nobody - feel free to take it <nobody>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P2 CC: tom.ware
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:

Description attila Mising name CLA 2011-09-12 03:21:06 EDT
when using jpa query with dynamic fetch groups the cursor result does not work

Steps: 

1) Create a jpa query "select .... " 
2) Add a dynamic fecth group 

FetchGroup fg = new FetchGroup("default");
fg.setShouldLoad(true);
// add attributes
query.setHint(QueryHints.FETCH_GROUP, fg);

3) Read with cursor:

query.setHint(QueryHints.CURSOR, true)
.setHint(QueryHints.CURSOR_INITIAL_SIZE, 30)
.setHint(QueryHints.CURSOR_PAGE_SIZE, 30)
.setHint(QueryHints.READ_ONLY, HintValues.TRUE)
.setFirstResult(bld.getResultStart())
.setMaxResults(bld.getResultSize());
			
Cursor c = query.unwrap(JpaQuery.class).getResultCursor();		

 - The cursor works if no fetch-group is specified
 - With fetch-group works the regular .getResultList();



The error log: 




java.lang.NullPointerException 
[2011-09-03 16:12:02.974] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession$1.iterate(AbstractSession.java:4530) 
[2011-09-03 16:12:02.974] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.descriptors.DescriptorIterator.startIterationOn(DescriptorIterator.java:666) 
[2011-09-03 16:12:02.974] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession.load(AbstractSession.java:4559) 
[2011-09-03 16:12:02.974] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1114) 
[2011-09-03 16:12:02.974] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:829) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1056) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:390) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession.internalExecuteQuery(AbstractSession.java:2816) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1501) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1483) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1457) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultCursor(EJBQueryImpl.java:661) 
[2011-09-03 16:12:02.975] ERROR "http-bio-8089"-exec-2       System.err                                                        	at net.nan21.dnet.core.presenter.service.AbstractDsService.doExport(AbstractDsService.java:450)
Comment 1 attila Mising name CLA 2011-09-12 03:22:46 EDT
see forum post:
http://www.eclipse.org/forums/index.php/t/238330/
 (cleaner code view :) )
Comment 2 Tom Ware CLA 2011-10-13 13:27:16 EDT
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.
Comment 3 Eclipse Webmaster CLA 2022-06-09 10:15:57 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink
Comment 4 Eclipse Webmaster CLA 2022-06-09 10:24:18 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink