Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/370.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何设置hibernate查询超时_Java_Hibernate_Hibernate Jpa - Fatal编程技术网

Java 如何设置hibernate查询超时

Java 如何设置hibernate查询超时,java,hibernate,hibernate-jpa,Java,Hibernate,Hibernate Jpa,我不熟悉Hibernate并使用以下版本的Hibernate: hibernate-core-4.3.11.Final hibernate-jpa-2.1-api-1.0.0.Final 我正在尝试设置查询超时。Hibernate的查询类具有用于设置超时的setTimeout API,但是它不起作用。找到了一些关于使用Query.setHint的帖子,但是这个API在上面的版本中不可用 有人能指导如何为上述版本设置查询超时吗 这就是我迄今为止所尝试的: session = //open hib

我不熟悉Hibernate并使用以下版本的Hibernate:

hibernate-core-4.3.11.Final
hibernate-jpa-2.1-api-1.0.0.Final
我正在尝试设置查询超时。Hibernate的查询类具有用于设置超时的setTimeout API,但是它不起作用。找到了一些关于使用Query.setHint的帖子,但是这个API在上面的版本中不可用

有人能指导如何为上述版本设置查询超时吗

这就是我迄今为止所尝试的:

session = //open hibernate session; 
Query query = session.createSQLQuery(sql).setCacheable(false); 
query.setTimeout(60);

请添加您迄今为止尝试的代码。即使当前不工作。会话=//打开hibernate会话;Query Query=session.createSQLQuery(sql).setCacheable(false);query.setTimeout(60);