org.iternine.jeppetto.dao
Interface GenericDAO<T,ID>

Type Parameters:
T - Persistent Class
ID - ID type for the persistent class.
All Known Subinterfaces:
AccessControlDAO<T,ID>, QueryModelDAO<T,ID>

public interface GenericDAO<T,ID>

A GenericDAO is the root interface for DAOs that fit within the Jeppetto framework. This defines base functionality such as finding a specific item by its identifier and saving an to the underlying data store.


Method Summary
 void delete(T object)
          Delete the specified object from the persistent store.
 void deleteById(ID id)
          Delete an object from the persistent store based on the id.
 Iterable<T> findAll()
          Find all objects of type T.
 T findById(ID id)
          Find an object T with the specified id.
 void flush()
          If the implementation supports lazy writes, manually flush changes to the external database
 void save(T object)
          Call save to insert a new object into the persistent store or update a preexisting object that has been modified.
 

Method Detail

findById

T findById(ID id)
           throws NoSuchItemException,
                  JeppettoException
Find an object T with the specified id.

Parameters:
id - of the desired object.
Returns:
Object with the specified id
Throws:
NoSuchItemException - if the object identified by the id is not found
JeppettoException - if any other failure occurs

findAll

Iterable<T> findAll()
                    throws JeppettoException
Find all objects of type T.

Returns:
Iterable of T
Throws:
JeppettoException - if any underlying failure occurs

save

void save(T object)
          throws OptimisticLockException,
                 JeppettoException
Call save to insert a new object into the persistent store or update a preexisting object that has been modified.

Parameters:
object - to save.
Throws:
OptimisticLockException - if optimistic locking is enabled and a save is attempted on an already modified object.
JeppettoException - if any other failure occurs

delete

void delete(T object)
            throws JeppettoException
Delete the specified object from the persistent store.

Parameters:
object - to delete.
Throws:
JeppettoException - if any underlying failure occurs

deleteById

void deleteById(ID id)
                throws JeppettoException
Delete an object from the persistent store based on the id.

Parameters:
id - of the object to delete.
Throws:
JeppettoException - if any underlying failure occurs

flush

void flush()
           throws JeppettoException
If the implementation supports lazy writes, manually flush changes to the external database

Throws:
JeppettoException - if any underlying failure occurs


Copyright © 2012. All Rights Reserved.