org.perfectjpattern.jee.api.integration.dao
Interface IBaseDao<Id,Element>

Type Parameters:
Id - Identification type
Element - Element type
All Superinterfaces:
IBaseReadOnlyDao<Id,Element>
All Known Subinterfaces:
ICustomerDao, IGenericDao<Id,Element>, IMovieBaseDao, IMovieGenericDao
All Known Implementing Classes:
AbstractHibernateManagedGenericDao, AbstractJpaManagedBaseDao, HibernateGenericDao, JpaBaseDao, MovieBaseDao, MovieGenericDao, SpringGenericDao

public interface IBaseDao<Id,Element>
extends IBaseReadOnlyDao<Id,Element>

Data Access Object (DAO) Pattern: Abstracts from any direct type of database or persistence mechanism. Provides specific operations without exposing details of the database.

Responsibility : Base Data Access Object definition including:

Version:
$Revision: 1.0 $Date: Feb 19, 2009 11:08:28 AM $
Author:
Giovanni Azua
See Also:
Data Access Object wiki definition
 

Method Summary
 Id create(Element anElement)
          Returns the ID of the newly created Element.
 boolean delete(Element anElement)
          Returns true if the Element was deleted, false otherwise i.e.
 void deleteAll()
          Deletes all Element from the persistent storage.
 boolean update(Element anElement)
          Returns true if the Element was updated, false otherwise i.e.
 
Methods inherited from interface org.perfectjpattern.jee.api.integration.dao.IBaseReadOnlyDao
contains, count, findAll, findById, getSession, getTransaction
 

Method Detail

create

Id create(Element anElement)
          throws DaoException,
                 IllegalArgumentException
Returns the ID of the newly created Element. Creates an Element in the persistent storage and returns its ID.

Parameters:
anElement - Element to create
Returns:
ID of the newly created Element
Throws:
DaoException
IllegalArgumentException - 'anElement' must not be null.

update

boolean update(Element anElement)
               throws DaoException,
                      IllegalArgumentException
Returns true if the Element was updated, false otherwise i.e. the Element was not found. Updates the given Element in the persistent storage.

Parameters:
anElement - Element to update
Returns:
true if the Element was updated, false otherwise.
Throws:
DaoException
IllegalArgumentException - 'anElement' must not be null.

delete

boolean delete(Element anElement)
               throws DaoException,
                      IllegalArgumentException
Returns true if the Element was deleted, false otherwise i.e. the Element was not found. Deletes the given Element from the persistent storage.

Parameters:
anElement - Element to delete
Returns:
true if the Element was deleted, false otherwise.
Throws:
DaoException
IllegalArgumentException - 'anElement' must not be null.

deleteAll

void deleteAll()
               throws DaoException
Deletes all Element from the persistent storage.

Throws:
DaoException


Copyright © 2007-2009. All Rights Reserved.