Hibernate中的日期文字 [英] Date literals in Hibernate
本文介绍了Hibernate中的日期文字的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我不知道如何在Hibernate查询语言中使用日期文字。我在JPA项目(如Eclipselink提供程序)中执行了以下操作,它可以正常工作。
SELECT m FROM Me m WHERE m。 dob< = {d'1984-10-06'}
但是这不起作用改变Hibernate(V 3.6.7)作为我的JPA项目的提供者。 参考文档说:
where子句中使用的表达式包括以下内容:
[...]
- SQL文字'foo',69,6.66E + 2,'1970-01-01 10:00:01.0'
I wonder how to use date literals in Hibernate query language. I did as follows in my JPA project (as Eclipselink the provider) and it works.
SELECT m FROM Me m WHERE m.dob <= {d '1984-10-06'}
But this does not work when I change Hibernate (V 3.6.7) as the provider for my JPA project.
解决方案
The reference documentation says:
Expressions used in the where clause include the following:
[...]
- SQL literals 'foo', 69, 6.66E+2, '1970-01-01 10:00:01.0'
这篇关于Hibernate中的日期文字的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文