Interface EntityViewRepository<E,V,PK extends Serializable>

Type Parameters:
E - Entity type.
V - Entity view type.
PK - Primary key type.
All Superinterfaces:
org.apache.deltaspike.core.spi.activation.Deactivatable
All Known Subinterfaces:
FullEntityViewRepository<E,V,PK>

public interface EntityViewRepository<E,V,PK extends Serializable> extends org.apache.deltaspike.core.spi.activation.Deactivatable
Base entity view repository interface. All methods are implemented by the CDI extension.
Since:
1.2.0
Author:
Moritz Becker
  • Method Summary

    Modifier and Type
    Method
    Description
    Lookup all existing entities of entity class <E>.
    findAll(int start, int max)
    Lookup a range of existing entities of entity class <E> with support for pagination.
    findAll(Pageable pageable)
    Returns a Page of entities meeting the paging restriction provided in the Pageable object.
    findAll(Sort sort)
    Lookup a range of existing entities of entity class <E> with support for pagination.
    findAll(Specification<E> specification, Pageable pageable)
    Returns a Page of entities meeting the paging and specification restriction provided in the Pageable and Specification objects.
    findBy(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
    Query by example - for a given object and a specific set of properties with support for pagination.
    findBy(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
    Query by example - for a given object and a specific set of properties.
    findBy(PK primaryKey)
    Entity lookup by primary key.
    findByLike(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
    Query by example - for a given object and a specific set of properties using a like operator for Strings with support for pagination.
    findByLike(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
    Query by example - for a given object and a specific set of properties using a like operator for Strings.
  • Method Details

    • findBy

      V findBy(PK primaryKey)
      Entity lookup by primary key. Convenicence method around EntityManager.find(Class, Object).
      Parameters:
      primaryKey - DB primary key.
      Returns:
      Entity identified by primary or null if it does not exist.
    • findAll

      List<V> findAll()
      Lookup all existing entities of entity class <E>.
      Returns:
      List of entities, empty if none found.
    • findAll

      List<V> findAll(int start, int max)
      Lookup a range of existing entities of entity class <E> with support for pagination.
      Parameters:
      start - The starting position.
      max - The maximum number of results to return
      Returns:
      List of entities, empty if none found.
    • findAll

      Iterable<V> findAll(Sort sort)
      Lookup a range of existing entities of entity class <E> with support for pagination.
      Parameters:
      sort - The sorting
      Returns:
      all entities sorted by the given options
    • findAll

      Page<V> findAll(Pageable pageable)
      Returns a Page of entities meeting the paging restriction provided in the Pageable object.
      Parameters:
      pageable - The paging configuration
      Returns:
      a page of entities
    • findAll

      Page<V> findAll(Specification<E> specification, Pageable pageable)
      Returns a Page of entities meeting the paging and specification restriction provided in the Pageable and Specification objects.
      Parameters:
      specification - The specification restricting the results
      pageable - The paging configuration
      Returns:
      a page of entities
    • findBy

      List<V> findBy(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
      Query by example - for a given object and a specific set of properties.
      Parameters:
      example - Sample entity. Query all like.
      attributes - Which attributes to consider for the query.
      Returns:
      List of entities matching the example, or empty if none found.
    • findBy

      List<V> findBy(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
      Query by example - for a given object and a specific set of properties with support for pagination.
      Parameters:
      example - Sample entity. Query all like.
      start - The starting position.
      max - The maximum number of results to return
      attributes - Which attributes to consider for the query.
      Returns:
      List of entities matching the example, or empty if none found.
    • findByLike

      List<V> findByLike(E example, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
      Query by example - for a given object and a specific set of properties using a like operator for Strings.
      Parameters:
      example - Sample entity. Query all like.
      attributes - Which attributes to consider for the query.
      Returns:
      List of entities matching the example, or empty if none found.
    • findByLike

      List<V> findByLike(E example, int start, int max, javax.persistence.metamodel.SingularAttribute<E,?>... attributes)
      Query by example - for a given object and a specific set of properties using a like operator for Strings with support for pagination.
      Parameters:
      example - Sample entity. Query all like.
      start - The starting position.
      max - The maximum number of results to return
      attributes - Which attributes to consider for the query.
      Returns:
      List of entities matching the example, or empty if none found.