|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.springframework.dao.support.DaoSupport
org.springframework.orm.hibernate3.support.HibernateDaoSupport
info.joseluismartin.dao.hibernate.HibernateDao<T,PK>
public class HibernateDao<T,PK extends Serializable>
Hibernate generic DAO implementation. Support pagination of results with filters using getPage(Page page) method.
Dao| Field Summary |
|---|
| Fields inherited from class org.springframework.dao.support.DaoSupport |
|---|
logger |
| Constructor Summary | |
|---|---|
HibernateDao()
|
|
HibernateDao(Class<T> persistentClass)
|
|
| Method Summary | ||
|---|---|---|
protected void |
applyOrder(Page<T> page,
Criteria criteria)
Apply Order to Criteria |
|
int |
count()
Count rows |
|
protected Order |
createOrder(Criteria criteria,
String propertyPath,
boolean ascending)
Create Order from criteria and property path |
|
void |
delete(T entity)
Delete a entity from db |
|
void |
deleteById(PK id)
Delete an object by primary key |
|
boolean |
enableFilter(Filter f)
Enable predefined filter in current session |
|
boolean |
exists(PK id)
Checks for existence of an object of type T using the id arg. |
|
List<T> |
findByNamedQuery(String queryName,
Map<String,Object> queryParams)
Find a list of records by using a named query |
|
T |
get(PK id)
Find object by id |
|
|
get(PK id,
Class<E> clazz)
|
|
List<T> |
getAll()
Get all models |
|
|
getAll(Class<E> clazz)
|
|
List<T> |
getAllDistinct()
|
|
Map<String,CriteriaBuilder> |
getCriteriaBuilderMap()
|
|
Class<T> |
getEntityClass()
|
|
List<Serializable> |
getKeys(Page<T> page)
Gets a List with keys of page |
|
Page<T> |
getPage(Page<T> page)
Get Page, apply filter if any. |
|
T |
initialize(T entity)
Initalize entity at default depth |
|
T |
initialize(T entity,
int depth)
Initalize entity |
|
boolean |
isCachePageQueries()
|
|
T |
save(T entity)
Save or update an object |
|
void |
setCachePageQueries(boolean cachePageQueries)
|
|
void |
setCriteriaBuilderMap(Map<String,CriteriaBuilder> criteriaBuilderMap)
|
|
void |
setEntityClass(Class<T> entityClass)
|
|
| Methods inherited from class org.springframework.orm.hibernate3.support.HibernateDaoSupport |
|---|
checkDaoConfig, convertHibernateAccessException, createHibernateTemplate, getHibernateTemplate, getSession, getSession, getSessionFactory, releaseSession, setHibernateTemplate, setSessionFactory |
| Methods inherited from class org.springframework.dao.support.DaoSupport |
|---|
afterPropertiesSet, initDao |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public HibernateDao()
public HibernateDao(Class<T> persistentClass)
persistentClass - | Method Detail |
|---|
public Page<T> getPage(Page<T> page)
getPage in interface PageableDataSource<T>page - with page definitions
public boolean enableFilter(Filter f)
f - Filter with filter name and parameters
protected void applyOrder(Page<T> page,
Criteria criteria)
page - the pagecriteria - the criteria
protected Order createOrder(Criteria criteria,
String propertyPath,
boolean ascending)
criteria - the hibernate criteria to apply order onpropertyPath - the property path
public Class<T> getEntityClass()
public void setEntityClass(Class<T> entityClass)
entityClass - the entityClass to setpublic void delete(T entity)
delete in interface Dao<T,PK extends Serializable>entity - public T save(T entity)
Dao
save in interface Dao<T,PK extends Serializable>entity - the object to save
public List<Serializable> getKeys(Page<T> page)
PageableDataSource
getKeys in interface PageableDataSource<T>public void deleteById(PK id)
Dao
deleteById in interface Dao<T,PK extends Serializable>id - the primary keypublic T initialize(T entity)
Dao
initialize in interface Dao<T,PK extends Serializable>entity - to intialize
public T initialize(T entity,
int depth)
Dao
initialize in interface Dao<T,PK extends Serializable>entity - to intializedepth - to descend.
public Map<String,CriteriaBuilder> getCriteriaBuilderMap()
public void setCriteriaBuilderMap(Map<String,CriteriaBuilder> criteriaBuilderMap)
criteriaBuilderMap - the criteriaBuilderMap to setpublic List<T> getAll()
getAll in interface Dao<T,PK extends Serializable>public List<T> getAllDistinct()
public List<T> findByNamedQuery(String queryName,
Map<String,Object> queryParams)
findByNamedQuery in interface Dao<T,PK extends Serializable>queryName - query name of the named queryqueryParams - a map of the query names and the values
public T get(PK id)
get in interface Dao<T,PK extends Serializable>id - the identifier (primary key) of the object to get
public boolean exists(PK id)
exists in interface Dao<T,PK extends Serializable>id - the id of the entity
public int count()
public boolean isCachePageQueries()
public void setCachePageQueries(boolean cachePageQueries)
cachePageQueries - the cachePageQueries to set
public <E> E get(PK id,
Class<E> clazz)
get in interface Dao<T,PK extends Serializable>public <E> List<E> getAll(Class<E> clazz)
getAll in interface Dao<T,PK extends Serializable>
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||