Error On ScrollableCurosr [message #666573] |
Thu, 21 April 2011 05:08 |
No real name 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.
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04651 seconds