开发者

App engine JPA date query

Assume I have object which represents TASK. Task have due date.

How do I create query to get all tasks which are due today?

Some working code like

"select t from Task t where dueDate=:today"

开发者_如何学Go

will be usefull.

Thank you in advance.


You assume that @Temporal is supported by Google's GAE/J plugin. It isn't, despite being reported to them over a year ago http://code.google.com/p/datanucleus-appengine/issues/detail?id=20&colspec=ID%20Stars%20Type%20Status%20Priority%20FoundIn%20TargetRelease%20Owner%20Summary


Assuming your dueDate is a Date annotated like this:

@Temporal(TemporalType.DATE)
private Date dueDate;

Then you can do the following query in JPQL:

select t from Task where t.dueDate = current_date
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜