Interface BaseEntityService.CriteriaQueryBuilder<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.CriteriaQueryBuilder<E>
    Functional interface to fine-grain a JPA criteria query for any of BaseEntityService.list(CriteriaQueryBuilder, Consumer) or BaseEntityService.find(CriteriaQueryBuilder, Consumer) 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 List<YourEntity> getFooByType(Type type) {
             return list((criteriaBuilder, query, root) -> {
                 query.where(criteriaBuilder.equal(root.get("type"), type));
             }, noop());
         }
    
     }