什么是“从DUAL选择1”的Hibernate等效物? [英] What is the Hibernate equivalent of "select 1 from DUAL"?

查看:129
本文介绍了什么是“从DUAL选择1”的Hibernate等效物?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

什么是最小的Hibernate查询?是否有相当于Hibernate选择从DUAL选择1?



我正在编写健康检查功能并希望执行最小查询,但使用HQL来保留代码是可移植的(而不是使用本地查询)。 解决方案

Hibernate的方言是什么翻译成各种数据库,并且没有健康检查或验证方言中的查询支持。这种事通常由连接池完成,而不是由Hibernate完成。参见例如 DBCP的验证查询属性


What is the minimal Hibernate query? Is there an equivalent of "select 1 from DUAL" for Hibernate?

I am writing a healthcheck function and would like to execute a minimal query, but use HQL to keep the code portable (as opposed to using a native query).

解决方案

Hibernate's dialects are what translate to the various databases, and there's no "health check" or "validation" query support in the dialects. This kind of thing is normally done by the connection pool, not by Hibernate. See, e.g., DBCP's validation query property.

这篇关于什么是“从DUAL选择1”的Hibernate等效物?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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