Package org.fugerit.java.core.db.dao
Class BasicDAO<T>
- java.lang.Object
-
- org.fugerit.java.core.db.dao.BasicDAO<T>
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
BasicDAO(ConnectionFactory connectionFactory)
protected
BasicDAO(DAOFactory daoFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
close(Connection conn)
protected int
delete(String query, FieldList fields)
protected boolean
execute(String query)
protected boolean
execute(String query, FieldList fields)
protected void
extractAll(ResultSet rs, List<T> list, RSExtractor<T> rse)
protected Connection
getConnection()
protected DAOFactory
getDaoFactory()
protected FieldFactory
getFieldFactory()
org.slf4j.Logger
getLogger()
Returnts the logger for this objectQueryWrapper
getQueryWrapper()
protected QueryWrapper
getQueryWrapperFor(String productName)
void
init(DAOFactory daoFactory)
protected List<T>
loadAll(String query, FieldList fields, RSExtractor<T> re)
protected List<T>
loadAll(String query, Field f, RSExtractor<T> re)
protected List<T>
loadAll(String query, RSExtractor<T> re)
protected void
loadAll(List<T> l, String query, FieldList fields, RSExtractor<T> re)
protected void
loadAll(List<T> l, String query, Field f, RSExtractor<T> re)
protected void
loadAll(List<T> l, String query, RSExtractor<T> re)
protected void
loadAll(List<T> list, OpDAO<T> op)
protected LoadResult<T>
loadAllResult(String query, FieldList fields, RSExtractor<T> re)
protected T
loadOne(String query, FieldList fields, RSExtractor<T> re)
protected T
loadOne(String query, Field f, RSExtractor<T> re)
protected T
loadOne(String query, RSExtractor<T> re)
protected T
loadOne(OpDAO<T> op)
FieldList
newFieldList()
FieldList
newFieldList(Field field)
List<T>
newList()
protected String
queryFormat(String sql, String method)
protected void
setAll(PreparedStatement ps, FieldList fields)
protected int
update(String query)
protected int
update(String query, Field field)
protected int
update(String query, FieldList fields)
protected int
update(OpDAO<T> op)
boolean
updateBatch(List<OpDAO<T>> opList)
boolean
updateTransaction(List<OpDAO<T>> opList)
-
-
-
Field Detail
-
NO_FIELDS
public static final FieldList NO_FIELDS
-
-
Constructor Detail
-
BasicDAO
protected BasicDAO(DAOFactory daoFactory)
-
BasicDAO
protected BasicDAO(ConnectionFactory connectionFactory)
-
-
Method Detail
-
getLogger
public org.slf4j.Logger getLogger()
Description copied from interface:LogObject
Returnts the logger for this object
-
extractAll
protected void extractAll(ResultSet rs, List<T> list, RSExtractor<T> rse) throws DAOException
- Throws:
DAOException
-
newFieldList
public FieldList newFieldList()
-
updateBatch
public boolean updateBatch(List<OpDAO<T>> opList) throws DAOException
- Throws:
DAOException
-
updateTransaction
public boolean updateTransaction(List<OpDAO<T>> opList) throws DAOException
- Throws:
DAOException
-
init
public void init(DAOFactory daoFactory)
-
getQueryWrapper
public QueryWrapper getQueryWrapper()
-
getQueryWrapperFor
protected QueryWrapper getQueryWrapperFor(String productName)
-
getDaoFactory
protected DAOFactory getDaoFactory()
-
getFieldFactory
protected FieldFactory getFieldFactory()
-
getConnection
protected Connection getConnection() throws DAOException
- Throws:
DAOException
-
close
protected void close(Connection conn) throws DAOException
- Throws:
DAOException
-
setAll
protected void setAll(PreparedStatement ps, FieldList fields) throws SQLException
- Throws:
SQLException
-
execute
protected boolean execute(String query, FieldList fields) throws DAOException
- Throws:
DAOException
-
execute
protected boolean execute(String query) throws DAOException
- Throws:
DAOException
-
update
protected int update(OpDAO<T> op) throws DAOException
- Throws:
DAOException
-
update
protected int update(String query, Field field) throws DAOException
- Throws:
DAOException
-
update
protected int update(String query) throws DAOException
- Throws:
DAOException
-
update
protected int update(String query, FieldList fields) throws DAOException
- Throws:
DAOException
-
delete
protected int delete(String query, FieldList fields) throws DAOException
- Throws:
DAOException
-
loadOne
protected T loadOne(OpDAO<T> op) throws DAOException
- Throws:
DAOException
-
loadAll
protected void loadAll(List<T> list, OpDAO<T> op) throws DAOException
- Throws:
DAOException
-
loadAll
protected void loadAll(List<T> l, String query, Field f, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAll
protected List<T> loadAll(String query, Field f, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadOne
protected T loadOne(String query, Field f, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAll
protected void loadAll(List<T> l, String query, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAll
protected List<T> loadAll(String query, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadOne
protected T loadOne(String query, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadOne
protected T loadOne(String query, FieldList fields, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAll
protected List<T> loadAll(String query, FieldList fields, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAllResult
protected LoadResult<T> loadAllResult(String query, FieldList fields, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
loadAll
protected void loadAll(List<T> l, String query, FieldList fields, RSExtractor<T> re) throws DAOException
- Throws:
DAOException
-
-