Reputation: 359
i am trying to make ebean query for this case: i want to filter users based on their last_update_time and update_frequency(in days) the query should get the users when last_update_time.plusDays(update_frequency)<now().
my query now looks like this:
List<User> users = Ebean.find(User.class).where().lt("last_update_time",DateTime.now()).findList();
i need to add update_frequency to the last_update_time. any idea how to do this?
Upvotes: 1
Views: 232
Reputation: 4021
If last_update_time.plusDays(update_frequency)<now()
... is valid SQL (for your DB) then you can just pass that in via the "raw" expression. query.where().raw(...) like:
List<User> users =
Ebean.find(User.class)
.where()
.lt("last_update_time",DateTime.now())
.raw("last_update_time.plusDays(update_frequency)<now()")
.findList()
Upvotes: 1