public abstract class AbstractDAO<T> extends Object implements DAO<T>
Modifier and Type | Field and Description |
---|---|
protected DataSource |
datasource |
protected static org.apache.log4j.Logger |
logger |
Constructor and Description |
---|
AbstractDAO() |
Modifier and Type | Method and Description |
---|---|
protected void |
closeConnection(Connection con) |
String |
delete(int id) |
protected Connection |
getConnection() |
DataSource |
getDatasource() |
protected abstract PreparedStatement |
getDeleteStatement(int id,
Connection con) |
protected abstract PreparedStatement |
getInsertStatement(T t,
Connection con) |
protected abstract int |
getLastId() |
protected abstract PreparedStatement |
getUpdateStatement(T t,
Connection con) |
Integer |
save(T t) |
void |
setDatasource(DataSource datasource) |
protected DataSource datasource
protected static org.apache.log4j.Logger logger
protected abstract PreparedStatement getUpdateStatement(T t, Connection con) throws SQLException
SQLException
protected abstract PreparedStatement getInsertStatement(T t, Connection con) throws SQLException
SQLException
protected abstract PreparedStatement getDeleteStatement(int id, Connection con) throws SQLException
SQLException
protected abstract int getLastId() throws SQLException, DaoException
SQLException
DaoException
public Integer save(T t) throws DaoException
save
in interface DAO<T>
DaoException
public String delete(int id) throws DaoException
delete
in interface DAO<T>
DaoException
protected Connection getConnection() throws DaoException
DaoException
protected void closeConnection(Connection con)
public DataSource getDatasource()
public void setDatasource(DataSource datasource)
Copyright © 2023. All rights reserved.