Skip to content

Add not() as a junction expression (like and() and or()) to the query criteria API #606

@rbygrave

Description

@rbygrave

So not() allows us to join multiple expression together that are wrapped in a NOT like:

    List<Customer> customers = Ebean.find(Customer.class)
        .where()
          .not()
            .gt("id", 1)
            .eq("anniversary", onAfter)
        .orderBy().asc("name")
        .findList();

Or in the nested case like:

    List<Customer> customers = Ebean.find(Customer.class)
        .where()
        .or()
          .eq("status", Customer.Status.ACTIVE)
          .not()
            .gt("id", 1)
            .eq("anniversary", onAfter)
          .endJunction() // end the not - optional in this case as it is the last one
        .orderBy().asc("name")
        .findList();

This also means that and(), or(), not() ... parallel the text search junctions of must(), should() and mustNot().

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions