Package nl.knaw.dans.lib.util
Class PersistenceProviderImpl<E>
java.lang.Object
io.dropwizard.hibernate.AbstractDAO<E>
nl.knaw.dans.lib.util.PersistenceProviderImpl<E>
- All Implemented Interfaces:
PersistenceProvider<E>
public class PersistenceProviderImpl<E>
extends io.dropwizard.hibernate.AbstractDAO<E>
implements PersistenceProvider<E>
-
Constructor Summary
ConstructorDescriptionPersistenceProviderImpl
(org.hibernate.SessionFactory sessionFactory, Class<E> entityClass) -
Method Summary
Modifier and TypeMethodDescription<T> org.hibernate.query.Query<T>
createQuery
(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) Creates a query from the given CriteriaQuery.void
Deletes the entity from the current session.Retrieves the entity with the given id from the current session.javax.persistence.criteria.CriteriaBuilder
Returns the CriteriaBuilder for the current session.Performs a saveOrUpdate in the current session.void
Updates the entity in the current session.Methods inherited from class io.dropwizard.hibernate.AbstractDAO
criteria, criteriaQuery, currentSession, get, getEntityClass, initialize, list, list, list, namedQuery, namedTypedQuery, query, uniqueResult, uniqueResult, uniqueResult
-
Constructor Details
-
PersistenceProviderImpl
-
-
Method Details
-
persist
Description copied from interface:PersistenceProvider
Performs a saveOrUpdate in the current session.- Specified by:
persist
in interfacePersistenceProvider<E>
- Overrides:
persist
in classio.dropwizard.hibernate.AbstractDAO<E>
- Parameters:
entity
- the entity to persist- Returns:
- the persisted entity
-
update
Description copied from interface:PersistenceProvider
Updates the entity in the current session.- Specified by:
update
in interfacePersistenceProvider<E>
- Parameters:
entity
- the entity to update
-
delete
Description copied from interface:PersistenceProvider
Deletes the entity from the current session.- Specified by:
delete
in interfacePersistenceProvider<E>
- Parameters:
entity
- the entity to delete
-
get
Description copied from interface:PersistenceProvider
Retrieves the entity with the given id from the current session.- Specified by:
get
in interfacePersistenceProvider<E>
- Parameters:
id
- the id of the entity to retrieve- Returns:
- the entity
-
getCriteriaBuilder
public javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()Description copied from interface:PersistenceProvider
Returns the CriteriaBuilder for the current session.- Specified by:
getCriteriaBuilder
in interfacePersistenceProvider<E>
- Returns:
- the CriteriaBuilder
-
createQuery
public <T> org.hibernate.query.Query<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) Description copied from interface:PersistenceProvider
Creates a query from the given CriteriaQuery.- Specified by:
createQuery
in interfacePersistenceProvider<E>
- Parameters:
criteriaQuery
- the CriteriaQuery to create a query from- Returns:
- the query
-