I'm using siena in a playframework app, also with google开发者_Go百科 app engine. I would like to build a query to get entities filtering with a field "date" of type java.util.Date, if it's possible.
I've tried with something like
List<MyEntity> matchdays = MyEntity.all()
.filter("date", ">01/01/2011")
.fetch();
But doesn't work. I suppose we can't use operators in this kind of queries. Is there a way to do this?
Thank you in advance.
Remember in a filter the > should be on the side of the field.
Moreover, you want to compare to a date so don't pass a String but a Date (current Siena doesn't manage this automatic conversion).
Try something like:
List<MyEntity> matchdays = MyEntity.all()
.filter("date>", new SimpleDateFormat("dd/MM/yyyy).parse("01/01/2011"))
.fetch();
Tell me if you have any problem, I will look at it!
精彩评论