I have a small project with a model that has ~6 string properties and 1 date. I'm writing a search method. The user can supply any (or none) of those fields and I want to find matching objects.Is it possible to build this query dynamically?
For the next guy, this is what I came up with:
String ebeanQL = "find MyThing where";
Finder<Long, MyThing> finder = MyThing.find;
com.avaje.ebean.Query<MyThing> query = finder.setQuery(ebeanQL);
for {
query.setParameter(key, value);
}
List<MyThing> results = finder.findList();