Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Error On ScrollableCurosr(JPA ScrollableCursor)
Error On ScrollableCurosr [message #666573] Thu, 21 April 2011 05:08 Go to next message
No real name is currently offline No real nameFriend
Messages: 3
Registered: April 2011
Junior Member
I used FETCH and Batch..nice it runs well

I got a lot of data so I tried with Scrollable cursor...

@Entity
@Table(name="PFESVC")
@NamedQueries({
@NamedQuery(
name = "ValoPfi.findAboutThousand",
//query = "select o from ValoPfi o where o._lIdPFI = 3297233",
query = "select o from ValoPfi o where o._lIdPFI < 626000",
hints={
@QueryHint(name=QueryHints.LEFT_FETCH,value="o._vpsPack"),
@QueryHint(name=QueryHints.BATCH,value="o._vpsPack._mpsFoto "),
@QueryHint(name=QueryHints.BATCH,value="o._vpsPack._psCompteEfColl "),
@QueryHint(name=QueryHints.BATCH,value="o._vpsPack._psCompteEfColl._vpsLotFacturation "),
@QueryHint(name=QueryHints.BATCH,value="o._vpsPack._psCompteEfColl._vpsJourFacturation "),
@QueryHint(name=QueryHints.LEFT_FETCH,value="o._vpsSvcCustomOto "),
@QueryHint(name=QueryHints.LEFT_FETCH,value="o._vpsCcs"),
@QueryHint(name=QueryHints.BATCH,value="o._vpsCcs._idComptePayeur "),
@QueryHint(name=QueryHints.SCROLLABLE_CURSOR,value="true")
})
})

The code..

EntityManagerFactory emf = PersistenceManager.getInstance().getEntityManagerFactory();
EntityManager em = emf.createEntityManager();

ScrollableCursor scrollableCursor = (ScrollableCursor)em.createNamedQuery("ValoPfi.findAboutThousand ").getSingleResult();

while (scrollableCursor.hasNext()) {
List<ValoPfi> result = scrollableCursor.next(10); --> Here Error Compilation cannot convert List<Object> to List<ValoPfi>
System.out.println(result.size());
}

If I use List<Object> result = scrollableCursor.next(10); then I compile but at run I got an error

[EL Severe]: 2011-04-20 13:44:33.485--ServerSession(28405330)--Thread(Thread[main,5, main])--Local Exception Stack:
Exception [EclipseLink-6057] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.QueryException
Exception Description: The method [getContainerClass()] is not a valid method to call on object [ScrollableCursorPolicy(page size = 10)].
at org.eclipse.persistence.exceptions.QueryException.methodNotV alid(QueryException.java:814)
at org.eclipse.persistence.internal.queries.ContainerPolicy.get ContainerClass(ContainerPolicy.java:771)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQL DatabaseQuery(EJBQueryImpl.java:255)
at org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQue ry(JPAQuery.java:106)
at org.eclipse.persistence.internal.jpa.JPAQuery.prepare(JPAQue ry.java:90)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:577)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:537)
at org.eclipse.persistence.internal.sessions.AbstractSession.pr ocessJPAQueries(AbstractSession.java:2173)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.initializeDescriptors(DatabaseSessionImpl.java:414)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.postConnectDatasource(DatabaseSessionImpl.java:680)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.loginAndDetectDatasource(DatabaseSessionImpl.java:628)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryPro vider.login(EntityManagerFactoryProvider.java:233)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. deploy(EntityManagerSetupImpl.java:394)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.getServerSession(EntityManagerFactoryImpl.java:185)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManager(EntityManagerFactoryImpl.java:230)
at btel.poc.dao.DaoDb.getScrollableCursor(DaoDb.java:117)
at test.TestPreload.main(TestPreload.java:17)

Exception in thread "main" javax.persistence.PersistenceException: Exception [EclipseLink-6057] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.QueryException
Exception Description: The method [getContainerClass()] is not a valid method to call on object [ScrollableCursorPolicy(page size = 10)].
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. deploy(EntityManagerSetupImpl.java:422)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.getServerSession(EntityManagerFactoryImpl.java:185)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManagerImpl(EntityManagerFactoryImpl.java:242)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryImp l.createEntityManager(EntityManagerFactoryImpl.java:230)
at btel.poc.dao.DaoDb.getScrollableCursor(DaoDb.java:117)
at test.TestPreload.main(TestPreload.java:17)
Caused by: Exception [EclipseLink-6057] (Eclipse Persistence Services - 2.2.0.v20110202-r8913): org.eclipse.persistence.exceptions.QueryException
Exception Description: The method [getContainerClass()] is not a valid method to call on object [ScrollableCursorPolicy(page size = 10)].
at org.eclipse.persistence.exceptions.QueryException.methodNotV alid(QueryException.java:814)
at org.eclipse.persistence.internal.queries.ContainerPolicy.get ContainerClass(ContainerPolicy.java:771)
at org.eclipse.persistence.internal.jpa.EJBQueryImpl.buildEJBQL DatabaseQuery(EJBQueryImpl.java:255)
at org.eclipse.persistence.internal.jpa.JPAQuery.processJPQLQue ry(JPAQuery.java:106)
at org.eclipse.persistence.internal.jpa.JPAQuery.prepare(JPAQue ry.java:90)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:577)
at org.eclipse.persistence.queries.DatabaseQuery.checkPrepare(D atabaseQuery.java:537)
at org.eclipse.persistence.internal.sessions.AbstractSession.pr ocessJPAQueries(AbstractSession.java:2173)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.initializeDescriptors(DatabaseSessionImpl.java:414)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.postConnectDatasource(DatabaseSessionImpl.java:680)
at org.eclipse.persistence.internal.sessions.DatabaseSessionImp l.loginAndDetectDatasource(DatabaseSessionImpl.java:628)
at org.eclipse.persistence.internal.jpa.EntityManagerFactoryPro vider.login(EntityManagerFactoryProvider.java:233)
at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl. deploy(EntityManagerSetupImpl.java:394)
... 5 more

An idea ?

Thank you for all

Christophe.
Re: Error On ScrollableCurosr [message #666654 is a reply to message #666573] Thu, 21 April 2011 13:20 Go to previous messageGo to next message
Chris Delahunt is currently offline Chris DelahuntFriend
Messages: 1039
Registered: July 2009
Senior Member
Hello Christophe,

Please file a bug and try adding the QueryHints.SCROLLABLE_CURSOR query hint to the query at execution time instead of at definition to see if that works around the issue. ie:
em.createNamedQuery("ValoPfi.findAboutThousand ").setHint(QueryHints.SCROLLABLE_CURSOR, Boolean.TRUE).getSingleResult();


Best Regards,
Chris
Re: Error On ScrollableCurosr [message #666671 is a reply to message #666573] Thu, 21 April 2011 14:02 Go to previous message
No real name is currently offline No real nameFriend
Messages: 3
Registered: April 2011
Junior Member
your code runs ouf thank you I have a poc and no time to create a SR...sorry...
Previous Topic:JPA query with hierarchy
Next Topic:JPA Dynamic Models
Goto Forum:
  


Current Time: Fri Nov 28 21:58:00 GMT 2014

Powered by FUDForum. Page generated in 0.01599 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software