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

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

public interface 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 : Partial base Data Access Object abstraction providing Read-Only features:

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

Method Summary
 boolean contains(Element anElement)
          Returns true if the specified Element exists in the persistent storage, false otherwise.
 int count()
          Returns the total number of records.
 List<Element> findAll()
          Returns all Elements from the persistent storage.
 Element findById(Id anId)
          Returns the Element matching the given ID.
 ISession getSession()
          Returns the ISession adapted from the implementation-specific
 ITransaction getTransaction()
          Returns the ITransaction adapted from the implementation-specific
 

Method Detail

contains

boolean contains(Element anElement)
                 throws DaoException,
                        IllegalArgumentException
Returns true if the specified Element exists in the persistent storage, false otherwise.

Parameters:
anElement - Element to find in this persistent storage.
Returns:
true if Element exists in the persistent storage, false otherwise
Throws:
DaoException
IllegalArgumentException - 'anId' must not be null.

count

int count()
          throws DaoException
Returns the total number of records. Provides a high-level reusable means to do a "SELECT * FROM ...". Noteworthy that every call to this function will trigger a new execution of a statement. Therefore if the count value is needed several times in the client code it is a good idea to cache it there.

Returns:
total number of records
Throws:
DaoException

findById

Element findById(Id anId)
                 throws DaoException,
                        IllegalArgumentException
Returns the Element matching the given ID. Retrieves an Element from the persistent storage using as input its ID.

Parameters:
anId - ID of the Element to retrieve.
Returns:
Element matching the given ID
Throws:
DaoException
IllegalArgumentException - 'anId' must not be null.

findAll

List<Element> findAll()
                      throws DaoException
Returns all Elements from the persistent storage.

Returns:
all Elements from the persistent storage.
Throws:
DaoException

getSession

ISession getSession()
Returns the ISession adapted from the implementation-specific

Returns:
ISession adapted from the implementation-specific
See Also:
IAdapter

getTransaction

ITransaction getTransaction()
Returns the ITransaction adapted from the implementation-specific

Returns:
ITransaction adapted from the implementation-specific
See Also:
IAdapter


Copyright © 2007-2009. All Rights Reserved.