java.sql.SQLException:Exhausted Resultset JPA EclipseLink

时间:2018-04-10 09:55:06

标签: java oracle jpa glassfish

我有以下代码:

final List<NotificationTrace> searchResult = entityManager
                .createNamedQuery(NotificationTrace.FIND_BY_NOTIFICATION_ID, NotificationTrace.class)
                .setParameter(NotificationTrace.NOTIFICATION_ID_PARAMETER_NAME, notificationId).getResultList();

命名查询定义:

@NamedQuery(name = NotificationTrace.FIND_BY_NOTIFICATION_ID, query = "select a from NotificationTrace a where a.notificationId = :"+NOTIFICATION_ID_PARAMETER_NAME)

从无状态EJB调用查询,而无状态EJB也由无状态SOAP Web服务端点调用。 deployemnt环境也是集群的,包含更多实例。

这会导致以下错误:

Internal Exception: java.sql.SQLException: Exhausted Resultset
Error Code: 17011
Call: SELECT ID, CREATED_AT, CREATED_BY, INTERACTION_ID, MODIFIED_AT, MODIFIED_BY, NOTIFICATION_ID, PROCESSING_MESSAGE, UPD_VERSION FROM S_SFD_NOTIFICATION_TRACE WHERE (NOTIFICATION_ID = ?)
    bind => [xxx]
Query: ReadAllQuery(name="NotificationTrace.findByNotificationId" referenceClass=NotificationTrace sql="SELECT ID, CREATED_AT, CREATED_BY, INTERACTION_ID, MODIFIED_AT, MODIFIED_BY, NOTIFICATION_ID, PROCESSING_MESSAGE, UPD_VERSION FROM S_SFD_NOTIFICATION_TRACE WHERE (NOTIFICATION_ID = ?)")
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getDetailedException(EJBQueryImpl.java:594)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:487)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.getResultList(EJBQueryImpl.java:761)
Caused by: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.3.4.v20160520-8886999): org.eclipse.persistence.exceptions.DatabaseException
Internal Exception: java.sql.SQLException: Exhausted Resultset
Error Code: 17011
Call: SELECT ID, CREATED_AT, CREATED_BY, INTERACTION_ID, MODIFIED_AT, MODIFIED_BY, NOTIFICATION_ID, PROCESSING_MESSAGE, UPD_VERSION FROM S_SFD_NOTIFICATION_TRACE WHERE (NOTIFICATION_ID = ?)
    bind => [xxx]
Query: ReadAllQuery(name="NotificationTrace.findByNotificationId" referenceClass=NotificationTrace sql="SELECT ID, CREATED_AT, CREATED_BY, INTERACTION_ID, MODIFIED_AT, MODIFIED_BY, NOTIFICATION_ID, PROCESSING_MESSAGE, UPD_VERSION FROM S_SFD_NOTIFICATION_TRACE WHERE (NOTIFICATION_ID = ?)")
    at org.eclipse.persistence.exceptions.DatabaseException.sqlException(DatabaseException.java:333)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processExceptionForCommError(DatabaseAccessor.java:1494)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(DatabaseAccessor.java:1235)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.fetchRow(DatabaseAccessor.java:999)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.processResultSet(DatabaseAccessor.java:723)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.basicExecuteCall(DatabaseAccessor.java:621)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.executeCall(DatabaseAccessor.java:535)
    at org.eclipse.persistence.internal.sessions.AbstractSession.basicExecuteCall(AbstractSession.java:1717)
    at org.eclipse.persistence.sessions.server.ClientSession.executeCall(ClientSession.java:253)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:207)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeCall(DatasourceCallQueryMechanism.java:193)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.executeSelectCall(DatasourceCallQueryMechanism.java:264)
    at org.eclipse.persistence.internal.queries.DatasourceCallQueryMechanism.selectAllRows(DatasourceCallQueryMechanism.java:648)
    at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRowsFromTable(ExpressionQueryMechanism.java:2617)
    at org.eclipse.persistence.internal.queries.ExpressionQueryMechanism.selectAllRows(ExpressionQueryMechanism.java:2570)
    at org.eclipse.persistence.queries.ReadAllQuery.executeObjectLevelReadQuery(ReadAllQuery.java:420)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:1084)
    at org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:844)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:1043)
    at org.eclipse.persistence.queries.ReadAllQuery.execute(ReadAllQuery.java:392)
    at org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1131)
    at org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2871)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1516)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1498)
    at org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1463)
    at org.eclipse.persistence.internal.jpa.EJBQueryImpl.executeReadQuery(EJBQueryImpl.java:485)
    ... 165 more
Caused by: java.sql.SQLException: Exhausted Resultset
    at oracle.jdbc.driver.OracleResultSetImpl.getTimestamp(OracleResultSetImpl.java:1381)
    at com.sun.gjc.spi.base.ResultSetWrapper.getTimestamp(ResultSetWrapper.java:327)
    at org.eclipse.persistence.platform.database.OraclePlatform.getObjectFromResultSet(OraclePlatform.java:461)
    at org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.getObject(DatabaseAccessor.java:1206)
    ... 188 more

我已经看过像plain exhausted result set exceptions这样的其他线程,但是在这里我没有与ResultSet交互,所有内容都已经被JPA抽象了。

实现来自glassfish-embedded-all-3.1.2.2.jar(EclipseLink)。该数据库是Oracle 11数据库。

奇怪的是,在并非所有情况下都会发生错误,看到成功的查询,之后,如果代码或应用程序没有任何更改,则会再次发生错误。

错误的原因是什么?

感谢。

0 个答案:

没有答案