T - concrete entity classpublic abstract class AbstractDao<T extends Serializable> extends Object implements Dao<T>
AbstractDao class contains generic methods for data access.| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDao()
Initializes DAO properties.
|
| Modifier and Type | Method and Description |
|---|---|
protected Number |
aggregate(org.hibernate.criterion.DetachedCriteria criteria)
Provides result of aggregate function in query.
|
protected void |
delete(org.hibernate.criterion.DetachedCriteria criteria)
Deletes entities by criteria.
|
void |
delete(List<T> entities)
delete method removes existing entities. |
protected void |
delete(Object entity)
Deletes entity which is not of type
T. |
void |
delete(T entity)
Removes entity.
|
List<T> |
find()
Returns all entities from data source.
|
T |
findById(Serializable id)
Returns entity with given id.
|
protected org.hibernate.criterion.DetachedCriteria |
getCriteria()
Provides search criteria which can be used for searches with criteria.
|
protected abstract org.springframework.orm.hibernate3.HibernateTemplate |
getTemplate()
Provides actual HibernateTemplate object.
|
protected List<T> |
hql(String query)
Executes HQL query.
|
protected List<T> |
hql(String query,
Object... values)
Executes HQL query.
|
protected List<T> |
hql(String query,
Object value)
Executes HQL query.
|
protected <U> List<U> |
list(org.hibernate.criterion.DetachedCriteria criteria)
Provides list of entities.
|
void |
save(List<T> entities)
save method saves list of entities. |
protected void |
save(Object entity)
Saves entity which is not of type
T. |
void |
save(T entity)
Saves entity.
|
protected <U> U |
unique(org.hibernate.criterion.DetachedCriteria criteria)
Provides unique entity with given criteria.
|
public List<T> find()
find in interface ReadOnlyDao<T extends Serializable>public T findById(Serializable id)
findById in interface ReadOnlyDao<T extends Serializable>id - entity's idpublic void save(T entity)
save in interface Dao<T extends Serializable>entity - entitypublic void save(List<T> entities)
save method saves list of entities.save in interface Dao<T extends Serializable>entities - entities for savingpublic void delete(T entity)
delete in interface Dao<T extends Serializable>entity - entitypublic void delete(List<T> entities)
delete method removes existing entities.delete in interface Dao<T extends Serializable>entities - entities to be deletedprotected org.hibernate.criterion.DetachedCriteria getCriteria()
protected <U> U unique(org.hibernate.criterion.DetachedCriteria criteria)
U - concrete entity classcriteria - criteriaprotected <U> List<U> list(org.hibernate.criterion.DetachedCriteria criteria)
U - concrete entity classcriteria - search criteriaprotected Number aggregate(org.hibernate.criterion.DetachedCriteria criteria)
criteria - criteriaprotected List<T> hql(String query)
query - queryprotected List<T> hql(String query, Object value)
query - queryvalue - valueprotected List<T> hql(String query, Object... values)
query - queryvalues - valuesprotected void save(Object entity)
T.entity - entity to be savedprotected void delete(Object entity)
T.entity - entity to be deletedprotected void delete(org.hibernate.criterion.DetachedCriteria criteria)
criteria - criteria for entities to be deletedprotected abstract org.springframework.orm.hibernate3.HibernateTemplate getTemplate()
Copyright © 2013 TFI branch of Engels Instutute of Technology. All Rights Reserved.