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: - DAOException – if unable to create the data.
createDVO¶
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: - DAOException – if unable to persist the data.
- ClassCastException – if the DAO data is not DataSourceDVO.
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: - DAOException – if unable to remove the data.
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: - DAOException – if unable to retrieve the data.
- ClassCastException – if the DAO data is not DataSourceDVO.
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.