休眠:设置默认查询超时? [英] Hibernate: set default query timeout?

查看:404
本文介绍了休眠:设置默认查询超时?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用Hibernate对我的数据库进行一些大的查询,而且有时会遇到超时。我想避免在每个 Query Criteria 手动设置超时。



是否有任何属性可以给我的 AnnotationConfiguration ,它会为我运行的所有查询设置可接受的默认值?



如果不是的话,我怎样才能在Hibernate查询中设置一个默认的超时值呢? JPA 2定义了 javax.persistence.query.timeout 提示来指定以毫秒为单位的默认超时时间。 Hibernate 3.5(目前仍处于测试阶段)将支持该提示。



另请参阅 http://opensource.atlassian.com/projects/hibernate/browse/HHH-4662


I am doing some big queries on my database with Hibernate and I sometimes hit timeouts. I would like to avoid setting the timeout manually on every Query or Criteria.

Is there any property I can give to my AnnotationConfiguration that would set an acceptable default for all queries I run?

If not, how can I set a default timeout value on Hibernate queries?

解决方案

JPA 2 defines the javax.persistence.query.timeout hint to specify default timeout in milliseconds. Hibernate 3.5 (currently still in beta) will support this hint.

See also http://opensource.atlassian.com/projects/hibernate/browse/HHH-4662

这篇关于休眠:设置默认查询超时?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆