views:

61

answers:

3

Hi There.

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"

will be usefull.

Thank you in advance.

A: 

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
Pascal Thivent
doesn't it count time?
waney
No, `current_date` returns `2010-05-21`
Pascal Thivent
now to implement same with tomorrow?
waney
and sorry to say, but it not working. I test it with addedDate = current_date on just created items, and it does not return anything
waney
A: 

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

DataNucleus
is there any workarounds for this problem?
waney
A: 

Any one who want this feature, should vote for this issue Here http://code.google.com/p/datanucleus-appengine/issues/detail?id=20

Serlet