net.dontdrinkandroot.persistence.dao

## Interface GenericDao

All Known Subinterfaces:
  TypedDao<E,K>

All Known Implementing Classes:
  GenericJpaDao, TypedJpaDao

    public interface GenericDao

General contract of a Data Access Object that manages `Entity` instances.

Author:
  Philip W. Sorst <philip@sorst.net>

### Method Summary

Methods
`<E extends Entity<K>,K> void` `delete(E entity, Class<E> clazz)` Deletes the given entity of the given class.
`<E extends Entity<K>,K> void` `delete(K id, Class<E> clazz)` Deletes the entity with the given id of the given class.
`<E extends Entity<K>,K> E` `find(K id, Class<E> clazz)` Finds the entity with the given id of the given class.
`<E extends Entity<K>,K> List<E>` `findAll(Class<E> clazz)` Finds all entities of the given class.
`<E extends Entity<K>,K> long` `getCount(Class<E> clazz)` Counts the entities of the given class.
`<E extends Entity<K>,K> E` `load(K id, Class<E> clazz)` Loads the entity with the given id of the given class or throws an Exception if it was not found.
`<E extends Entity<K>,K> E` `save(E entity)` Saves the given entity.

### Method Detail

#### save

    <E extends Entity<K>,K> E save(E entity)

Saves the given entity.

Returns:
  The saved instance of the entity.

#### delete

    <E extends Entity<K>,K> void delete(E entity,
                                      Class<E> clazz)

Deletes the given entity of the given class.

#### delete

    <E extends Entity<K>,K> void delete(K id,
                                      Class<E> clazz)

Deletes the entity with the given id of the given class.

#### find

    <E extends Entity<K>,K> E find(K id,
                                 Class<E> clazz)

Finds the entity with the given id of the given class.

#### findAll

    <E extends Entity<K>,K> List<E> findAll(Class<E> clazz)

Finds all entities of the given class.

#### load

    <E extends Entity<K>,K> E load(K id,
                                 Class<E> clazz)

Loads the entity with the given id of the given class or throws an Exception if it was not found.

#### getCount

    <E extends Entity<K>,K> long getCount(Class<E> clazz)

Counts the entities of the given class.