精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
|
|
---|---|
作者 | 正文 |
发表时间:2008-05-27
这个问题也搞过我很郁闷,如果你没有用缓存的话,而出现这个问题,其实就是你数据源的问题,hibernate自带的数据源有bug,你换个就好了
|
|
返回顶楼 | |
发表时间:2008-05-30
个人感觉还是缓存的问题,因为JDBC操作会绕过hibernate造成hibernate并不知道数据已经清空。所以才出现这个问题,但是我怀疑楼主是否开了二级缓存,如果打开了二级缓存这种问题是可能的,但是如果没有使用二级缓存,以上的推动就有问题了。因为二级缓存hibernate默认是不打开的
|
|
返回顶楼 | |
发表时间:2008-05-30
reno_k 写道 感谢blackteal
关于问题二,查了一下英文的网站,发现还真多,英文并不是太好,所以只看了关键的部分,就是说,避免用单态模式创建session my sessionFactory generated by myeclipse is working fine. I dont know why singleton is not good, could you please tell us more details? For your second question, I think it is due to session connection pool. the default connection pool in hibernate is not for production use. for an example, if you use hibernate to connect mysql, normally, after 8 hours of no activity, the connection will fail and can not be auto recovered. that is a problem we call "connection failure over night". please check your hibernate connection pool setting to see if that is the case. |
|
返回顶楼 | |
发表时间:2008-05-30
silence1214 写道 这个问题也搞过我很郁闷,如果你没有用缓存的话,而出现这个问题,其实就是你数据源的问题,hibernate自带的数据源有bug,你换个就好了
hibernate官方就不建议使用他自带的连接池实现^_^ |
|
返回顶楼 | |
发表时间:2008-05-30
是不是不用hibernate自带的连接池就没这个问题啊.
|
|
返回顶楼 | |
发表时间:2008-05-30
dmewy 写道 是不是不用hibernate自带的连接池就没这个问题啊.
the connection pool is related to LZ's second question only. If you take a look at the hibernate boot log, you can see a line indicate that the default connection pool of hibernate is not for production. try to use DHCP or C3P0 instead, it should solve the DB connection failure. For the first question, I also think that is due to second level cache. |
|
返回顶楼 | |