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

    Constructors
    Constructor
    Description
    PersistenceProviderImpl(org.hibernate.SessionFactory sessionFactory, Class<E> entityClass)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    <T> org.hibernate.query.Query<T>
    createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery)
    Creates a query from the given CriteriaQuery.
    void
    delete(E entity)
    Deletes the entity from the current session.
    get(Long id)
    Retrieves the entity with the given id from the current session.
    javax.persistence.criteria.CriteriaBuilder
    Returns the CriteriaBuilder for the current session.
    persist(E entity)
    Performs a saveOrUpdate in the current session.
    void
    update(E entity)
    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

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • PersistenceProviderImpl

      public PersistenceProviderImpl(org.hibernate.SessionFactory sessionFactory, Class<E> entityClass)
  • Method Details

    • persist

      public E persist(E entity)
      Description copied from interface: PersistenceProvider
      Performs a saveOrUpdate in the current session.
      Specified by:
      persist in interface PersistenceProvider<E>
      Overrides:
      persist in class io.dropwizard.hibernate.AbstractDAO<E>
      Parameters:
      entity - the entity to persist
      Returns:
      the persisted entity
    • update

      public void update(E entity)
      Description copied from interface: PersistenceProvider
      Updates the entity in the current session.
      Specified by:
      update in interface PersistenceProvider<E>
      Parameters:
      entity - the entity to update
    • delete

      public void delete(E entity)
      Description copied from interface: PersistenceProvider
      Deletes the entity from the current session.
      Specified by:
      delete in interface PersistenceProvider<E>
      Parameters:
      entity - the entity to delete
    • get

      public E get(Long id)
      Description copied from interface: PersistenceProvider
      Retrieves the entity with the given id from the current session.
      Specified by:
      get in interface PersistenceProvider<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 interface PersistenceProvider<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 interface PersistenceProvider<E>
      Parameters:
      criteriaQuery - the CriteriaQuery to create a query from
      Returns:
      the query