Bug 299 : API Change for Conjunction / Disjunction (AND/OR) in expression API
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.7.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
20/05/2010
Updated 
20/05/2010
Type 
Bug
 
Attachments 
No attachments

I have made a change to the expression API for Conjunction (List of expressions added with AND) and Disjunction (List of expression added with OR).

List<Customer> list = server.find(Customer.class)
        .where().disjunction()
                    .startsWith("name", "r")
                    .eq("anniversary", onAfter)
                    .eq("status", Customer.Status.ACTIVE)
                    .endJunction()
        .where().gt("id", 20)
        .order().asc("name")
        .findList();

Junction extends ExpressionList so you can simply add a bunch of expressions after the conjunction() or disjunction().

Use endJunction() to take you back to the 'parent' expression list or use where() to take you to the 'root' level expression list (WHERE clause).

 
woResponse

Upload a file