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)
How many rows match these criteria?
The same value as
countLong(Criteria), coerced to int. |
int |
count(org.hibernate.Query query)
How many rows match this query?
|
long |
countLong(org.hibernate.Criteria criteria)
How many rows match these criteria?
|
T |
create(Context context,
T t)
Create a new instance of this type in the database.
|
org.hibernate.Criteria |
createCriteria(Context context,
Class<T> persistentClass)
Create criteria matching an entity type or a supertype thereof.
|
org.hibernate.Criteria |
createCriteria(Context context,
Class<T> persistentClass,
String alias)
Create criteria matching an entity type or a supertype thereof.
|
org.hibernate.Query |
createQuery(Context context,
String query)
Create a parsed query from a query expression.
|
void |
delete(Context context,
T t)
Remove an instance from the database.
|
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)
Fetch the entity identified by its legacy database identifier.
|
T |
findByID(Context context,
Class clazz,
UUID id)
Fetch the entity identified by its UUID primary key.
|
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)
The Session used to manipulate entities of this type.
|
Iterator<T> |
iterate(org.hibernate.Query query)
Get an iterator over a stream of query results.
|
List<T> |
list(org.hibernate.Criteria criteria)
Get the entities matched by the given Criteria.
|
List<T> |
list(org.hibernate.Query query)
Get the entities matching a given parsed query.
|
void |
save(Context context,
T t)
Persist this instance in the database.
|
T |
singleResult(org.hibernate.Criteria criteria)
Retrieve a single result selected by criteria.
|
T |
singleResult(org.hibernate.Query query)
Retrieve a single result matching a query.
|
T |
uniqueResult(org.hibernate.Criteria criteria)
Retrieve a unique result selected by criteria.
|
T |
uniqueResult(org.hibernate.Query query)
Retrieve a unique result selected by a query.
|
public T create(Context context, T t) throws SQLException
GenericDAOcreate in interface GenericDAO<T>context - current DSpace context.t - type to be created.SQLExceptionpublic void save(Context context, T t) throws SQLException
GenericDAOsave in interface GenericDAO<T>context - current DSpace context.t - type created here.SQLException - passed through.protected org.hibernate.Session getHibernateSession(Context context) throws SQLException
context - current DSpace context.SQLExceptionpublic void delete(Context context, T t) throws SQLException
GenericDAOdelete in interface GenericDAO<T>context - current DSpace context.t - type of the instance to be removed.SQLException - passed through.public 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
GenericDAOfindByID in interface GenericDAO<T>context - current DSpace context.clazz - class of entity to be found.id - primary key of the database record.SQLExceptionpublic T findByID(Context context, Class clazz, int id) throws SQLException
GenericDAOfindByID in interface GenericDAO<T>context - current DSpace context.clazz - class of entity to be found.id - legacy database record ID.SQLException - passed through.public 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
context - current DSpace context.persistentClass - specifies the type to be matched by the criteria.SQLException - passed through.public org.hibernate.Criteria createCriteria(Context context, Class<T> persistentClass, String alias) throws SQLException
context - current DSpace context.persistentClass - specifies the type to be matched by the criteria.alias - alias for the type.SQLException - passed through.public org.hibernate.Query createQuery(Context context, String query) throws SQLException
context - current DSpace context.query - textual form of the query.SQLExceptionpublic List<T> list(org.hibernate.Criteria criteria)
criteria - description of desired entities.public List<T> list(org.hibernate.Query query)
query - the query to be executed.public T uniqueResult(org.hibernate.Criteria criteria)
criteria - description of the desired entity.public T uniqueResult(org.hibernate.Query query)
query - description of the desired entity.public T singleResult(org.hibernate.Criteria criteria)
criteria - description of the desired entities.public T singleResult(org.hibernate.Query query)
query - description of desired entities.public Iterator<T> iterate(org.hibernate.Query query)
query - description of desired entities.public int count(org.hibernate.Criteria criteria)
countLong(Criteria), coerced to int.criteria - description of the rows.public int count(org.hibernate.Query query)
query - description of the rows.public long countLong(org.hibernate.Criteria criteria)
criteria - description of the rows.Copyright © 2022 LYRASIS. All rights reserved.