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
SQLExceptionprotected abstract PreparedStatement getInsertStatement(T t, Connection con) throws SQLException
SQLExceptionprotected abstract PreparedStatement getDeleteStatement(int id, Connection con) throws SQLException
SQLExceptionprotected abstract int getLastId()
throws SQLException,
DaoException
SQLExceptionDaoExceptionpublic Integer save(T t) throws DaoException
save in interface DAO<T>DaoExceptionpublic String delete(int id) throws DaoException
delete in interface DAO<T>DaoExceptionprotected Connection getConnection() throws DaoException
DaoExceptionprotected void closeConnection(Connection con)
public DataSource getDatasource()
public void setDatasource(DataSource datasource)
Copyright © 2021. All rights reserved.