net.sf.derquinsej.hib3
Interface GenericDAO<T,ID extends Serializable>

Type Parameters:
T - Persistent type.
ID - Primary Key type.
All Superinterfaces:
DAO
All Known Implementing Classes:
GenericDAOImpl

public interface GenericDAO<T,ID extends Serializable>
extends DAO

Generic DAO interface.

Author:
Andres Rodriguez

Method Summary
 void delete(T entity)
          Deletes an entity instance.
 void deleteById(ID id)
          Deletes an entity instance.
 List<T> findAll()
          Returns all entities of the persistent type.
 T findById(ID id, boolean lock)
          Finds an entity by ID.
 T save(T entity)
          Saves an entity.
 T saveOrUpdate(T entity)
          Saves or updates an entity, depending upon resolution of the unsaved-value checks.
 T update(T entity)
          Updates an entity.
 
Methods inherited from interface net.sf.derquinsej.hib3.DAO
clear, flush, sync
 

Method Detail

findById

T findById(ID id,
           boolean lock)
Finds an entity by ID.

Parameters:
id - ID
lock - If the entity shall be locked.
Returns:
The requested entity or null if it is not found.

findAll

List<T> findAll()
Returns all entities of the persistent type.

Returns:
A list with all the instances.

save

T save(T entity)
Saves an entity.

Parameters:
entity - Entity to save.
Returns:
The persisted entity.

update

T update(T entity)
Updates an entity.

Parameters:
entity - Entity to update.
Returns:
The persisted entity.

saveOrUpdate

T saveOrUpdate(T entity)
Saves or updates an entity, depending upon resolution of the unsaved-value checks.

Parameters:
entity - Entity to persist.
Returns:
The persisted entity.

delete

void delete(T entity)
Deletes an entity instance.

Parameters:
entity - Instance to delete.

deleteById

void deleteById(ID id)
Deletes an entity instance.

Parameters:
id - Id of the instance to delete.


Copyright © 2012. All Rights Reserved.