javax.persistence.PersistenceException:org.hibernate.exception.JDBCConnectionException:无法加载实体:

时间:2018-11-01 22:19:04

标签: java hibernate

该应用程序是在gwt和hibernate上开发的。我更改了其中一个表(stasite),以在Oracle DB中再增加一个列,其大小为varchar(10)。我在实体类中添加了setters和getters。 但是,当我运行该应用程序时,出现以下错误-UnplannedEvent是主表之一。但是,当我在stasite实体类中注释新添加的变量时,应用程序可以正常工作。

**Below is the error -**

    [ERROR] [WARNING] Failed to destroy resource: com.mchange.v2.c3p0.impl.NewPooledConnection@42362b92java.sql.SQLException: Some resources failed to close properly while closing com.mchange.v2.c3p0.impl.NewPooledConnection@42362b92
    [ERROR]     at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:571)
    [ERROR]     at com.mchange.v2.c3p0.impl.NewPooledConnection.close(NewPooledConnection.java:234)
    [ERROR]     at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.destroyResource(C3P0PooledConnectionPool.java:470)
    [ERROR]     at com.mchange.v2.resourcepool.BasicResourcePool$1DestroyResourceTask.run(BasicResourcePool.java:964)
    [ERROR]     at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
    [ERROR] 
    [INFO] [02/11/18 08:45:17:243]  INFO DefaultLoadEventListener:160 - Error performing load command
    [INFO] org.hibernate.exception.JDBCConnectionException: could not load an entity: [com.shared.serviceevent.unplannedevent.entity.UnplannedEvent#10186148]
    [INFO]  at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:99)
    [INFO]  at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:66)
    [INFO]  at org.hibernate.loader.Loader.loadEntity(Loader.java:1937)
    [INFO]  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:86)
    [INFO]  at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:76)
    [INFO]  at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3270)
    [INFO]  at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:496)
    [INFO]  at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:477)
    [INFO]  at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:227)
    [INFO]  at org.hibernate.event.def.DefaultLoadEventListener.proxyOrLoad(DefaultLoadEventListener.java:285)
    [INFO]  at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:152)
    [INFO]  at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:1080)
    [INFO]  at org.hibernate.impl.SessionImpl.get(SessionImpl.java:997)
    [INFO]  at org.hibernate.impl.SessionImpl.get(SessionImpl.java:990)
    [INFO]  at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:610)
    [INFO]  at org.hibernate.ejb.AbstractEntityManagerImpl.find(AbstractEntityManagerImpl.java:585)
    [INFO]  at com.hub.server.common.dao.JpaDao.fetch(JpaDao.java:50)
    [INFO]  at com.hub.server.serviceevent.service.ServiceEventService.getServiceEvent(ServiceEventService.java:163)
    [INFO]  at com.hub.server.serviceevent.service.ServiceEventService.getServiceEvent(ServiceEventService.java:156)
    [INFO]  at com.hub.server.serviceevent.service.ServiceEventService.save(ServiceEventService.java:208)
    [INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    [INFO]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    [INFO]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    [INFO]  at java.lang.reflect.Method.invoke(Method.java:606)
    [INFO]  at net.sf.gilead.gwt.PersistentRemoteService.processCall(PersistentRemoteService.java:174)
    [INFO]  at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost(RemoteServiceServlet.java:373)
    [INFO]  at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost(AbstractRemoteServiceServlet.java:62)
    [INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:755)
    [INFO]  at javax.servlet.http.HttpServlet.service(HttpServlet.java:848)
    [INFO]  at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:686)
    [INFO]  at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:501)
    [INFO]  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:137)
    [INFO]  at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:557)
    [INFO]  at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:231)
    [INFO]  at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1086)
    [INFO]  at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:428)
    [INFO]  at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:193)
    [INFO]  at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1020)
    [INFO]  at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:135)
    [INFO]  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    [INFO]  at org.eclipse.jetty.server.handler.RequestLogHandler.handle(RequestLogHandler.java:68)
    [INFO]  at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:116)
    [INFO]  at org.eclipse.jetty.server.Server.handle(Server.java:370)
    [INFO]  at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:489)
    [INFO]  at org.eclipse.jetty.server.AbstractHttpConnection.content(AbstractHttpConnection.java:960)
    [INFO]  at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.content(AbstractHttpConnection.java:1021)
    [INFO]  at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:865)
    [INFO]  at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:240)
    [INFO]  at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:82)
    [INFO]  at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:668)
    [INFO]  at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:52)
    [INFO]  at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:608)
    [INFO]  at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:543)
    [INFO]  at java.lang.Thread.run(Thread.java:745)
    [INFO] Caused by: java.sql.SQLRecoverableException: No more data to read from socket
    [INFO]  at oracle.jdbc.driver.T4CMAREngine.unmarshalUB1(T4CMAREngine.java:1157)
    [INFO]  at oracle.jdbc.driver.T4CTTIfun.receive(T4CTTIfun.java:350)
    [INFO]  at oracle.jdbc.driver.T4CTTIfun.doRPC(T4CTTIfun.java:227)
    [INFO]  at oracle.jdbc.driver.T4C8Oall.doOALL(T4C8Oall.java:531)
    [INFO]  at oracle.jdbc.driver.T4CPreparedStatement.doOall8(T4CPreparedStatement.java:208)
    [INFO]  at oracle.jdbc.driver.T4CPreparedStatement.executeForDescribe(T4CPreparedStatement.java:886)
    [INFO]  at oracle.jdbc.driver.OracleStatement.executeMaybeDescribe(OracleStatement.java:1175)
    [INFO]  at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1296)
    [INFO]  at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3613)
    [INFO]  at oracle.jdbc.driver.OraclePreparedStatement.executeQuery(OraclePreparedStatement.java:3657)
    [INFO]  at oracle.jdbc.driver.OraclePreparedStatementWrapper.executeQuery(OraclePreparedStatementWrapper.java:1495)
    [INFO]  at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeQuery(NewProxyPreparedStatement.java:76)
    [INFO]  at org.hibernate.jdbc.AbstractBatcher.getResultSet(AbstractBatcher.java:208)
    [INFO]  at org.hibernate.loader.Loader.getResultSet(Loader.java:1849)
    [INFO]  at org.hibernate.loader.Loader.doQuery(Loader.java:718)
    [INFO]  at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:270)
    [INFO]  at org.hibernate.loader.Loader.loadEntity(Loader.java:1933)
    [INFO]  ... 51 more

1 个答案:

答案 0 :(得分:0)

您是否在添加的字段上添加了@Column?

如果没有,请添加并尝试。

另一个原因可能是因为您的列名与实体中变量的名称不匹配。因此请确保您还添加了列的名称。