读书人

hibernate里可以设立查询数据库超过

发布时间: 2012-10-30 16:13:36 作者: rapoo

hibernate里可以设置查询数据库,超过8s就不再执行查询了?
我现在想实现这样的功能,查询数据库时,执行时间超过8秒,就不再继续查了。跳到提示页面Session sess = factory.openSession();try { //set transaction timeout to 3 seconds sess.getTransaction().setTimeout(3); sess.getTransaction().begin(); // do some work ... sess.getTransaction().commit()}catch (RuntimeException e) { sess.getTransaction().rollback(); throw e; // or display error message}finally { sess.close();} 2 楼 songdan_79 2006-12-28 如果想查询执行ns就转到其它页面怎么办呢 3 楼 songdan_79 2006-12-28 怎么没人回呢?时我的问题太简单了?还是我没说明白呢

这种问题的解决方案是什么呢?不用hibernate配置也行 4 楼 kj23 2006-12-28 spring的事务可以配置超时的

http://www.iteye.com/topic/22299

读书人网 >其他数据库

热点推荐