Interface BaseEntityService.QueryBuilder<E>

  • Type Parameters:
    E - The generic base entity type.
    Enclosing class:
    BaseEntityService<I extends Comparable<I> & Serializable,​E extends BaseEntity<I>>
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @FunctionalInterface
    protected static interface BaseEntityService.QueryBuilder<E>
    Functional interface to fine-grain a JPA criteria query for any of BaseEntityService.getPage(Page, boolean) methods.

    You do not need this interface directly. Just supply a lambda. Below is an usage example:

     @Stateless
     public class YourEntityService extends BaseEntityService<YourEntity> {
    
         public void getPageOfFooType(Page page, boolean count) {
             return getPage(page, count, (criteriaBuilder, query, root) -> {
                 query.where(criteriaBuilder.equal(root.get("type"), Type.FOO));
             });
         }
    
     }