
public abstract class StatementExecutor<E> extends Object implements AbstractDAO<E>
| Modifier and Type | Field and Description |
|---|---|
protected Connection |
connection |
| Modifier | Constructor and Description |
|---|---|
protected |
StatementExecutor(Connection con) |
| Modifier and Type | Method and Description |
|---|---|
void |
close() |
void |
closeResultSet(ResultSet rs) |
void |
closeStatement(Statement stm) |
void |
delete(E e1)
Remove the specified object from the persistance layer
|
void |
deleteAll()
Remove all objects from the persistance layer
|
void |
executeAction(PreparedStatement stm) |
ResultSet |
executeQuery(PreparedStatement stm) |
void |
executeUpdate(PreparedStatement stm) |
boolean |
exist(String id)
Verify if an object with the specified id exists in the
persistance layer
|
List<E> |
find(List<Filter> filters)
Retrieve all objects corresponding to the given filters in a List
from the persistance lsayer
|
List<E> |
getAll()
Retrieve all objects in a List from the persistance layer
|
protected abstract String |
getDeleteAllRequest() |
protected abstract String |
getDeleteRequest() |
protected abstract String |
getExistRequest() |
abstract E |
getFromResultSet(ResultSet set) |
protected abstract String |
getGetAllRequest() |
protected abstract String |
getId(E e1) |
protected abstract String |
getInsertRequest() |
protected abstract Object[] |
getInsertValues(E e1) |
protected abstract String |
getSelectRequest() |
protected abstract String |
getUpdateRequest() |
protected abstract Object[] |
getUpdateValues(E e1) |
void |
insert(E e1)
Insert the specified object in the persistance layer
|
E |
select(String id)
Retrieve the object with the specified id from the persistance
layer
|
void |
setParameters(PreparedStatement stm,
Object... values) |
void |
update(E e1)
Update the specified object in the persistance layer
|
protected final Connection connection
protected StatementExecutor(Connection con)
public abstract E getFromResultSet(ResultSet set) throws SQLException, DAOConnectionException
SQLExceptionDAOConnectionExceptionpublic void setParameters(PreparedStatement stm, Object... values) throws SQLException
SQLExceptionpublic void executeUpdate(PreparedStatement stm) throws SQLException
SQLExceptionpublic void executeAction(PreparedStatement stm) throws SQLException
SQLExceptionpublic ResultSet executeQuery(PreparedStatement stm) throws SQLException
SQLExceptionpublic void closeStatement(Statement stm)
public void closeResultSet(ResultSet rs)
public void close()
close in interface AbstractDAO<E>protected abstract String getSelectRequest()
protected abstract String getGetAllRequest()
protected abstract String getExistRequest()
protected abstract String getInsertRequest()
protected abstract String getUpdateRequest()
protected abstract String getDeleteRequest()
protected abstract String getDeleteAllRequest()
public void delete(E e1) throws DAOConnectionException, DAONoDataException
AbstractDAOdelete in interface AbstractDAO<E>e1 - object to deleteDAOConnectionException - If a data access error occursDAONoDataException - if no data are availablepublic void deleteAll()
throws DAOConnectionException
AbstractDAOdeleteAll in interface AbstractDAO<E>DAOConnectionException - If a data access error occurspublic List<E> getAll() throws DAOConnectionException
AbstractDAOgetAll in interface AbstractDAO<E>DAOConnectionException - If data access error occurspublic List<E> find(List<Filter> filters) throws DAOConnectionException
AbstractDAOfind in interface AbstractDAO<E>filters - List of filterDAOConnectionException - If data access error occurspublic boolean exist(String id) throws DAOConnectionException
AbstractDAOexist in interface AbstractDAO<E>id - id of the object verifiedDAOConnectionException - If a data access error occurspublic E select(String id) throws DAOConnectionException, DAONoDataException
AbstractDAOselect in interface AbstractDAO<E>id - id of the object requestedDAOConnectionException - If a data access error occursDAONoDataException - if no data are availablepublic void insert(E e1) throws DAOConnectionException
AbstractDAOinsert in interface AbstractDAO<E>e1 - object to insertDAOConnectionException - If a data access error occurspublic void update(E e1) throws DAOConnectionException, DAONoDataException
AbstractDAOupdate in interface AbstractDAO<E>e1 - object to updateDAOConnectionException - If a data access error occursDAONoDataException - if no data are availableCopyright © 2009–2020 Waarp. All rights reserved.