DAO

public interface DAO

The Data Access Object is the primary object of the DAO pattern. The Data Access Object abstracts the underlying data access implementation for the Business Object to enable transparent access to the data source. The Business Object also delegates data load and store operations to the Data Access Object.

Author:Hugo Y. K. Lam

Methods

create

public void create(DVO data)

Creates the given DAO data, which is managed by this DAO, in the underlying data source.

Parameters:
  • data – the DAO data.
Throws:

createDVO

public DVO createDVO()

Creates a data value object for this DAO.

Returns:a new data value object for this DAO.

daoCreated

public void daoCreated()

Invoked after the dao has been created successfully.

getFactory

public DAOFactory getFactory()

Gets the DAO factory of this DAO.

Returns:the DAO factory.

getParameters

public Properties getParameters()

Gets the parameters of this DAO.

Returns:the parameters of this DAO.

getTransaction

public Transaction getTransaction()

Gets the transaction of this DAO.

Throws:
Returns:

the transaction of this DAO or null if there is none.

persist

public boolean persist(DVO data)

Persists the given DAO data, which is managed by this DAO, to the underlying data source.

Parameters:
  • data – the DAO data.
Throws:
Returns:

true if the data is found and persisted.

remove

public boolean remove(DVO data)

Removes the given DAO data, which is managed by this DAO, from the underlying data source.

Parameters:
  • data – the DAO data.
Throws:
Returns:

true if the data is found and removed.

retrieve

public boolean retrieve(DVO data)

Retrieves the given DAO data, which is managed by this DAO, from the underlying data source.

Parameters:
  • data – the DAO data.
Throws:
Returns:

true if the data is found and retrieved.

setTransaction

public void setTransaction(Transaction transaction)

Sets a transaction to this DAO.

Parameters:
  • transaction – the transaction of this DAO.
Throws:
  • DAOException – if the transaction is not supported by this DAO.