2010-05-21 28 views
4

假设我有代表TASK的对象。任务有到期日。应用引擎JPA日期查询

如何创建查询以获取今天到期的所有任务?

将是有用的:

一些工作代码 “今天从任务t其中的dueDate =选择T”。

预先感谢您。

回答

0

假设你dueDate是注释这样的Date

@Temporal(TemporalType.DATE) 
private Date dueDate; 

那么你可以做下面的查询在JPQL:

select t from Task where t.dueDate = current_date 
+0

不是它算不上时间吗? – waney 2010-05-21 19:08:03

+0

不,现在''current_date'现在返回'2010-05-21' – 2010-05-21 19:10:26

+0

要与明天一样吗? – waney 2010-05-21 19:15:43