+ -
当前位置:首页 → 问答吧 → Hibernate提示could not load an entity

Hibernate提示could not load an entity

时间:2011-12-08

来源:互联网

系统是Win7,在本地Mysql数据库里测试没问题。但是,如果连接上远程Linux上的Mysql数据库,过一段时间就会出现问题,在插入一条记录时,提示下列信息。
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.hibernate.exception.JDBCConnectionException: could not load an entity: [entity.User#1]
  ……

root cause

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet successfully received from the server was 280,216 milliseconds ago. The last packet sent successfully to the server was 1 milliseconds ago.
sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
  ……

希望大家指点迷津……

作者: rokeer   发布时间: 2011-12-08

连接超时引起的
要看你具体的代码

作者: tianshi1017   发布时间: 2011-12-08

你是不是用到了连接池呢?
  这个问题应该是连接失效了.mysql数据库的连接是有时长的,超过设置的时长,mysql服务器自动会把连接回收.这个时长需要在mysql的my.ini文件里面设置.

作者: liupengxia   发布时间: 2011-12-08

热门下载

更多