0

我想问一下,如何将此 postgres 查询转换为 HQL :

select * from transactions where trans_time >= date(now() - 60 * interval '1 day')

如何将该查询(粗体)转换为 hql?

谢谢

4

1 回答 1

2
Calendar minDate = Calendar.getInstance();
minDate.add(Calendar.DATE, -60);
String hql = "select t from Transaction t where t.transactionTime >= :minDate";
List<Transaction> result = session.createQuery(hql)
                                  .setTimestamp("minDate", cal.getTime())
                                  .list();
于 2012-05-28T06:56:04.380 回答