T
- type of business entitypublic abstract class DaoTemplate<T extends BusinessEntity> extends Dao
logger, TABLE_NAME_PREFIX
Constructor and Description |
---|
DaoTemplate() |
Modifier and Type | Method and Description |
---|---|
protected void |
copyBetweenTablesBy(String fromTable,
String toTable,
String byColumn,
Object byValue)
Replaces records matching condition byColumn = byValue in toTable with matching record in fromTable.
|
protected abstract org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> |
getRowMapper()
Returns the row mapper that creates an instance of the business object from a query result set.
|
protected String |
getSelectAndFromClause()
Builds SELECT ...
|
abstract String |
getTableName()
Returns the name of the table that contains business entities represented by
|
List<T> |
loadAll()
Finds all entities in the database.
|
List<T> |
loadAllBy(QueryCriteria criteria)
Find all entities mathing the given query criteria.
|
List<T> |
loadAllBy(String columnName,
Object value)
Find all entities in the database by satisfying condition columnName = value
|
T |
loadBy(String columnName,
Object value)
Find the first entity in the database by satisfying condition columnName = value
|
protected List<T> |
postLoadAllBy(List<T> items)
Method called after list of items is loaded.
|
protected T |
postLoadBy(T item)
Method called after a single item is loaded.
|
boolToSmallint, createVirtuosoConnectionWrapper, executeInTransaction, getLookupFactory, jdbcQuery, jdbcQuery, jdbcQueryForInt, jdbcQueryForInt, jdbcQueryForInt, jdbcQueryForList, jdbcQueryForObject, jdbcQueryForObject, jdbcQueryForObject, jdbcQueryForObject, jdbcUpdate, jdbcUpdate, jdbcUpdate, setDaoLookupFactory
public abstract String getTableName()
protected abstract org.springframework.jdbc.core.simple.ParameterizedRowMapper<T> getRowMapper()
protected String getSelectAndFromClause()
DaoForEntityWithSurrogateKey
should redefine DaoForEntityWithSurrogateKey.load(Integer)
to use unambiguous key column.public final List<T> loadAll()
Exception
public final List<T> loadAllBy(String columnName, Object value)
columnName
- columnvalue
- valuepublic final List<T> loadAllBy(QueryCriteria criteria)
criteria
- query filter and order by criteriaprotected List<T> postLoadAllBy(List<T> items)
items
- items as loaded from databasepublic final T loadBy(String columnName, Object value)
columnName
- columnvalue
- valueprotected T postLoadBy(T item)
loadBy(String, Object)
will then return value modified by this method.item
- item as loaded from databaseloadBy(String, Object)
Copyright © 2013. All Rights Reserved.