Class DefaultExampleExpression

  • All Implemented Interfaces:
    ExampleExpression, Expression, SpiExpression

    public class DefaultExampleExpression
    extends Object
    implements SpiExpression, ExampleExpression
    A "Query By Example" type of expression.

    Pass in an example entity and for each non-null scalar properties an expression is added.

    
     // create an example bean and set the properties
     // with the query parameters you want
     Customer example = new Customer();
     example.setName("Rob%");
     example.setNotes("%something%");
    
     List<Customer> list = Ebean.find(Customer.class)
       .where()
       .exampleLike(example)
       .findList();