public abstract class AbstractHibernateDao<T extends Serializable> extends Object
Modifier and Type | Field and Description |
---|---|
protected org.hibernate.SessionFactory |
sessionFactory |
Constructor and Description |
---|
AbstractHibernateDao(Class<T> clazzToSet) |
Modifier and Type | Method and Description |
---|---|
long |
countAll()
Get the count of all records in database
|
long |
countByHql(String secondHalfOfHql)
Get the count of all records in database
|
long |
countByHql(String secondHalfOfHql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes)
Get the count of all records in database
|
long |
countBySql(String fullSql)
Get the count of all records in database
|
long |
countBySql(String fullSql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes)
Get the count of all records in database
|
void |
create(T entity) |
void |
delayedCreate(T entity) |
void |
delayedDelete(T entity) |
void |
delayedDeleteById(Long entityId) |
void |
delayedUpdate(T entity) |
void |
delete(T entity) |
void |
deleteById(Serializable entityId) |
List<T> |
getAll() |
List<T> |
getAllByHql(String secondHalfOfHql) |
List<T> |
getAllByHql(String secondHalfOfHql,
Integer offset,
Integer limit) |
List<T> |
getAllByHql(String secondHalfOfHql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes) |
List<T> |
getAllByHql(String secondHalfOfHql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes,
Integer offset,
Integer limit) |
List<T> |
getAllByHql(String secondHalfOfHql,
Object paramValue,
org.hibernate.type.Type paramType)
Get all by HQL with one pair of parameterType-value
|
List<T> |
getAllByHql(String secondHalfOfHql,
Object paramValue1,
org.hibernate.type.Type paramType1,
Object paramValue2,
org.hibernate.type.Type paramType2)
Get all by HQL with two pairs of parameterType-value
|
List<T> |
getAllByHql(String secondHalfOfHql,
Object paramValue1,
org.hibernate.type.Type paramType1,
Object paramValue2,
org.hibernate.type.Type paramType2,
Object paramValue3,
org.hibernate.type.Type paramType3)
Get all by HQL with three pairs of parameterType-value
|
List<T> |
getAllBySql(String fullSql) |
List<T> |
getAllBySql(String fullSql,
Integer offset,
Integer limit)
Get all by SQL with specific offset and limit
|
List<T> |
getAllBySql(String fullSql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes)
Get all by SQL with pairs of parameterType-value
|
List<T> |
getAllBySql(String fullSql,
Object[] paramValues,
org.hibernate.type.Type[] paramTypes,
Integer offset,
Integer limit) |
List<T> |
getAllBySql(String fullSql,
Object paramValue,
org.hibernate.type.Type paramType)
Get all by SQL with one pair of parameterType-value
|
List<T> |
getAllBySql(String fullSql,
Object paramValue1,
org.hibernate.type.Type paramType1,
Object paramValue2,
org.hibernate.type.Type paramType2)
Get all by SQL with two pairs of parameterType-value
|
List<T> |
getAllBySql(String fullSql,
Object paramValue1,
org.hibernate.type.Type paramType1,
Object paramValue2,
org.hibernate.type.Type paramType2,
Object paramValue3,
org.hibernate.type.Type paramType3)
Get all by SQL with three pairs of parameterType-value
|
T |
getById(Serializable id) |
protected org.hibernate.Session |
getCurrentSession()
Get current session.
|
protected Class<?> |
getEntityClass() |
void |
setSessionFactory(org.hibernate.SessionFactory sessionFactory) |
void |
update(T entity) |
protected Class<?> getEntityClass()
public T getById(Serializable id)
public List<T> getAllByHql(String secondHalfOfHql)
secondHalfOfHql
- parts after "from <class_name> "public List<T> getAllByHql(String secondHalfOfHql, Integer offset, Integer limit)
secondHalfOfHql
- offset
- the number of first record in the whole query result to be returned, records numbers start from 0limit
- the maximum number of records to returnpublic List<T> getAllByHql(String secondHalfOfHql, Object[] paramValues, org.hibernate.type.Type[] paramTypes)
secondHalfOfHql
- parts after "from <class_name> "paramValues
- paramTypes
- public List<T> getAllByHql(String secondHalfOfHql, Object paramValue, org.hibernate.type.Type paramType)
secondHalfOfHql
- paramValue
- paramType
- public List<T> getAllByHql(String secondHalfOfHql, Object paramValue1, org.hibernate.type.Type paramType1, Object paramValue2, org.hibernate.type.Type paramType2)
secondHalfOfHql
- paramValue1
- paramType1
- paramValue2
- paramType2
- public List<T> getAllByHql(String secondHalfOfHql, Object paramValue1, org.hibernate.type.Type paramType1, Object paramValue2, org.hibernate.type.Type paramType2, Object paramValue3, org.hibernate.type.Type paramType3)
secondHalfOfHql
- paramValue1
- paramType1
- paramValue2
- paramType2
- paramValue3
- paramType3
- public List<T> getAllByHql(String secondHalfOfHql, Object[] paramValues, org.hibernate.type.Type[] paramTypes, Integer offset, Integer limit)
secondHalfOfHql
- parts after "from <class_name> "paramValues
- paramTypes
- offset
- the number of first record in the whole query result to be returned, records numbers start from 0limit
- the maximum number of records to returnpublic List<T> getAllBySql(String fullSql, Integer offset, Integer limit)
fullSql
- offset
- the number of first record in the whole query result to be returned, records numbers start from 0limit
- the maximum number of records to returnpublic List<T> getAllBySql(String fullSql, Object[] paramValues, org.hibernate.type.Type[] paramTypes)
fullSql
- paramValues
- paramTypes
- public List<T> getAllBySql(String fullSql, Object paramValue, org.hibernate.type.Type paramType)
fullSql
- paramValue
- paramType
- public List<T> getAllBySql(String fullSql, Object paramValue1, org.hibernate.type.Type paramType1, Object paramValue2, org.hibernate.type.Type paramType2)
fullSql
- paramValue1
- paramType1
- paramValue2
- paramType2
- public List<T> getAllBySql(String fullSql, Object paramValue1, org.hibernate.type.Type paramType1, Object paramValue2, org.hibernate.type.Type paramType2, Object paramValue3, org.hibernate.type.Type paramType3)
fullSql
- paramValue1
- paramType1
- paramValue2
- paramType2
- paramValue3
- paramType3
- public List<T> getAllBySql(String fullSql, Object[] paramValues, org.hibernate.type.Type[] paramTypes, Integer offset, Integer limit)
fullSql
- paramValues
- paramTypes
- offset
- the number of first record in the whole query result to be returned, records numbers start from 0limit
- the maximum number of records to returnpublic long countAll()
public long countByHql(String secondHalfOfHql)
secondHalfOfHql
- parts after "from <class_name> "public long countByHql(String secondHalfOfHql, Object[] paramValues, org.hibernate.type.Type[] paramTypes)
secondHalfOfHql
- parts after "from <class_name> "paramValues
- paramTypes
- public long countBySql(String fullSql)
fullSql
- public long countBySql(String fullSql, Object[] paramValues, org.hibernate.type.Type[] paramTypes)
fullSql
- paramValues
- paramTypes
- public void create(T entity)
public void update(T entity)
public void delete(T entity)
public void deleteById(Serializable entityId)
public void delayedCreate(T entity)
public void delayedUpdate(T entity)
public void delayedDelete(T entity)
public void delayedDeleteById(Long entityId)
public void setSessionFactory(org.hibernate.SessionFactory sessionFactory)
protected final org.hibernate.Session getCurrentSession()
Copyright © 2014. All Rights Reserved.