简体   繁体   English

我如何使用此SQL查询来休眠条件函数

[英]How can i use this sql query to hibernate criteria function

How can i use this sql query to hibernate criteria select * from DailyExpense where month(tdate)=07 and year(tdate)=2016 Daily expense is my pojo class and tdate is column name. 我如何使用此SQL查询来休眠条件,请select * from DailyExpense where month(tdate)=07 and year(tdate)=2016日常开支是我的pojo类,而tdate是列名。 i want to select current month data only how to select based on month only. 我只想选择当前月份数据,如何仅基于月份选择。

Use HQL. 使用HQL。

from DailyExpense where year(birthDate)=:year and month(birthDate)=:month" 

Afterwards, bind :year and :month parameters using query's setString(whetever value of your month and year) 然后,使用查询的setString(月份和年份的最大值)绑定:year和:month参数

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM