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
ConstructorsConstructorDescriptionPersistenceProviderImpl(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.voidDeletes the entity from the current session.Retrieves the entity with the given id from the current session.javax.persistence.criteria.CriteriaBuilderReturns the CriteriaBuilder for the current session.Performs a saveOrUpdate in the current session.voidUpdates 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:PersistenceProviderPerforms a saveOrUpdate in the current session.- Specified by:
persistin interfacePersistenceProvider<E>- Overrides:
persistin classio.dropwizard.hibernate.AbstractDAO<E>- Parameters:
entity- the entity to persist- Returns:
- the persisted entity
-
update
Description copied from interface:PersistenceProviderUpdates the entity in the current session.- Specified by:
updatein interfacePersistenceProvider<E>- Parameters:
entity- the entity to update
-
delete
Description copied from interface:PersistenceProviderDeletes the entity from the current session.- Specified by:
deletein interfacePersistenceProvider<E>- Parameters:
entity- the entity to delete
-
get
Description copied from interface:PersistenceProviderRetrieves the entity with the given id from the current session.- Specified by:
getin 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:PersistenceProviderReturns the CriteriaBuilder for the current session.- Specified by:
getCriteriaBuilderin interfacePersistenceProvider<E>- Returns:
- the CriteriaBuilder
-
createQuery
public <T> org.hibernate.query.Query<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) Description copied from interface:PersistenceProviderCreates a query from the given CriteriaQuery.- Specified by:
createQueryin interfacePersistenceProvider<E>- Parameters:
criteriaQuery- the CriteriaQuery to create a query from- Returns:
- the query
-