Hi all,
I want to create a query that check a date stored in a table with an interval (with Postgresql).
I've tested it with 2 methods :
1)
user = models.User.find("guid = ? and status = ? and updated >= (now() - interval '20 minutes')", udid, Status.ACCEPTED).first();
2)
Calendar now = Calendar.getInstance();
now.add(Calendar.MINUTE, -20);
user = models.User.find("guid = ? and status = ? and updated >= ?", udid, Status.ACCEPTED, now.getTime()).first();
The result of the first method is an error : ERROR ~ line 1:81: unexpected token: '20 minutes'
And second method don't throw me an error, but the user object is null (i've checked my data with the same request directly on postgresql).
Anybody can help me to understand how to do this trick?
Thx.
Mickaël.