Package nl.knaw.dans.lib.util
Interface PersistenceProvider<E>
- All Known Implementing Classes:
PersistenceProviderImpl
public interface PersistenceProvider<E>
-
Method Summary
Modifier and TypeMethodDescription<T> javax.persistence.TypedQuery<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.
-
Method Details
-
persist
Performs a saveOrUpdate in the current session.- Parameters:
entity
- the entity to persist- Returns:
- the persisted entity
-
update
Updates the entity in the current session.- Parameters:
entity
- the entity to update
-
delete
Deletes the entity from the current session.- Parameters:
entity
- the entity to delete
-
get
Retrieves the entity with the given id from the current session.- Parameters:
id
- the id of the entity to retrieve- Returns:
- the entity
-
getCriteriaBuilder
javax.persistence.criteria.CriteriaBuilder getCriteriaBuilder()Returns the CriteriaBuilder for the current session.- Returns:
- the CriteriaBuilder
-
createQuery
<T> javax.persistence.TypedQuery<T> createQuery(javax.persistence.criteria.CriteriaQuery<T> criteriaQuery) Creates a query from the given CriteriaQuery.- Parameters:
criteriaQuery
- the CriteriaQuery to create a query from- Returns:
- the query
-