Interface GenericDAO<E,ID extends Serializable>

Type Parameters:
E - Entity type
ID - Identity of the entity

public interface GenericDAO<E,ID extends Serializable>
Version:
$Revision$
Author:
Trong Tran
  • Method Summary

    Modifier and Type
    Method
    Description
    Get the number of entities with the specified type and id from the datasource.
    create(E entity)
    Insert a new entity.
    void
    createAll(List<E> entities)
    Insert a list of new entities in the persistence context.
    void
    delete(E entity)
    Delete the specified entity from the persistence context.
    void
    Remove all of the entities from the persistence context.
    void
    deleteAll(List<E> entities)
    Remove all of the specified entities from the persistence context.
    find(ID id)
    Return an entity which is associated with specified id.
    Get a list of all object of the specified type from the datasource.
    update(E entity)
    Update the entity in the persistence context.
    void
    updateAll(List<E> entities)
    Update the entity in the persistence context.
  • Method Details

    • count

      Long count()
      Get the number of entities with the specified type and id from the datasource.
      Returns:
      the entity, null if none is found
    • find

      E find(ID id)
      Return an entity which is associated with specified id.
      Returns:
      an entity. Otherwise, return NULL.
    • findAll

      List<E> findAll()
      Get a list of all object of the specified type from the datasource.
      Returns:
      a list of entities
    • create

      E create(E entity)
      Insert a new entity. If the entity already exist, use update(E entity) instead
      Returns:
      the new entity
    • createAll

      void createAll(List<E> entities)
      Insert a list of new entities in the persistence context. If the entities already exist, use update(E entity) instead
    • update

      E update(E entity)
      Update the entity in the persistence context. If the entity does not already exist, use create(E entity) instead
      Returns:
      the just created entity
    • updateAll

      void updateAll(List<E> entities)
      Update the entity in the persistence context. If the entity does not already exist, use create(E entity) instead
    • delete

      void delete(E entity)
      Delete the specified entity from the persistence context.
    • deleteAll

      void deleteAll(List<E> entities)
      Remove all of the specified entities from the persistence context.
    • deleteAll

      void deleteAll()
      Remove all of the entities from the persistence context.