Interface Data.CrudRepository<E,ID>

Type Parameters:
E - the entity type
ID - the identifier type
All Superinterfaces:
Data.BasicRepository<E,ID>, Data.GenericRepository<E,ID>
Enclosing class:
Data

public static interface Data.CrudRepository<E,ID> extends Data.BasicRepository<E,ID>
Data repository interface for CRUD entity operations. CRUD entity operations are:
  • Create
  • Read
  • Update
  • Delete
  • Method Details

    • insert

      <T extends E> T insert(T entity)
      Insert provided entity. This method will insert a new record into the database. The operation will fail if the record is already present in the database.
      Type Parameters:
      T - type of the entity
      Parameters:
      entity - the entity to persist, shall not be null
      Returns:
      persisted entity, never returns null
      Throws:
      DataException - if the entity is null or the operation has failed
    • insertAll

      <T extends E> Iterable<T> insertAll(Iterable<T> entities)
      Insert all provided entities. This method will insert a new record into the database. The operation will fail if the record is already present in the database or entities are not unique.
      Type Parameters:
      T - type of the entity
      Parameters:
      entities - the entities to persist, shall not be null
      Returns:
      persisted entity, never returns null
      Throws:
      DataException - if the entity is null or the operation has failed
    • update

      <T extends E> T update(T entity)
      Update provided entity. This operation will fail if the record is not already present in the database.
      Type Parameters:
      T - type of the entity
      Parameters:
      entity - the entity to persist, shall not be null
      Returns:
      updated entity, never returns null
      Throws:
      DataException - if the entity is null or the operation has failed
    • updateAll

      <T extends E> Iterable<T> updateAll(Iterable<T> entities)
      Update all provided entities. This operation will fail if the record is not already present in the database.
      Type Parameters:
      T - type of the entity
      Parameters:
      entities - the entities to persist, shall not be null
      Returns:
      updated entities, never returns null
      Throws:
      DataException - if the entities are null or the operation has failed