T - class typepublic abstract class AbstractHibernateDAO<T> extends Object implements GenericDAO<T>
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractHibernateDAO() |
| Modifier and Type | Method and Description |
|---|---|
int |
count(org.hibernate.Criteria criteria) |
int |
count(org.hibernate.Query query) |
long |
countLong(org.hibernate.Criteria criteria) |
T |
create(Context context,
T t) |
org.hibernate.Criteria |
createCriteria(Context context,
Class<T> persistentClass) |
org.hibernate.Criteria |
createCriteria(Context context,
Class<T> persistentClass,
String alias) |
org.hibernate.Query |
createQuery(Context context,
String query) |
void |
delete(Context context,
T t) |
List<T> |
findAll(Context context,
Class<T> clazz)
Fetch all persisted instances of a given object type.
|
T |
findByID(Context context,
Class clazz,
int id) |
T |
findByID(Context context,
Class clazz,
UUID id) |
List<T> |
findMany(Context context,
org.hibernate.Query query)
Execute a JPA Criteria query and return a collection of results.
|
List<T> |
findMany(Context context,
String query)
Execute a JPQL query and return a collection of results.
|
T |
findUnique(Context context,
String query)
Execute a JPQL query returning a unique result.
|
protected org.hibernate.Session |
getHibernateSession(Context context) |
Iterator<T> |
iterate(org.hibernate.Query query) |
List<T> |
list(org.hibernate.Criteria criteria) |
List<T> |
list(org.hibernate.Query query) |
void |
save(Context context,
T t) |
T |
singleResult(org.hibernate.Criteria criteria)
Retrieve a single result from the query.
|
T |
singleResult(org.hibernate.Query query) |
T |
uniqueResult(org.hibernate.Criteria criteria)
Retrieve a unique result from the query.
|
T |
uniqueResult(org.hibernate.Query query) |
public T create(Context context, T t) throws SQLException
create in interface GenericDAO<T>SQLExceptionpublic void save(Context context, T t) throws SQLException
save in interface GenericDAO<T>SQLExceptionprotected org.hibernate.Session getHibernateSession(Context context) throws SQLException
SQLExceptionpublic void delete(Context context, T t) throws SQLException
delete in interface GenericDAO<T>SQLExceptionpublic List<T> findAll(Context context, Class<T> clazz) throws SQLException
GenericDAOfindAll in interface GenericDAO<T>clazz - the desired type.SQLException - if database errorpublic T findUnique(Context context, String query) throws SQLException
GenericDAOfindUnique in interface GenericDAO<T>query - JPQL query stringSQLException - if database errorpublic T findByID(Context context, Class clazz, UUID id) throws SQLException
findByID in interface GenericDAO<T>SQLExceptionpublic T findByID(Context context, Class clazz, int id) throws SQLException
findByID in interface GenericDAO<T>SQLExceptionpublic List<T> findMany(Context context, String query) throws SQLException
GenericDAOfindMany in interface GenericDAO<T>query - JPQL query stringSQLException - if database errorpublic List<T> findMany(Context context, org.hibernate.Query query) throws SQLException
context - query - JPQL query stringSQLException - if database errorpublic org.hibernate.Criteria createCriteria(Context context, Class<T> persistentClass) throws SQLException
SQLExceptionpublic org.hibernate.Criteria createCriteria(Context context, Class<T> persistentClass, String alias) throws SQLException
SQLExceptionpublic org.hibernate.Query createQuery(Context context, String query) throws SQLException
SQLExceptionpublic T uniqueResult(org.hibernate.Criteria criteria)
criteria - public T singleResult(org.hibernate.Criteria criteria)
criteria - public T singleResult(org.hibernate.Query query)
public T uniqueResult(org.hibernate.Query query)
public int count(org.hibernate.Criteria criteria)
public int count(org.hibernate.Query query)
public long countLong(org.hibernate.Criteria criteria)
Copyright © 2017 DuraSpace. All rights reserved.