Package org.fryske_akademy.jpa
Class JpaUtil
java.lang.Object
org.fryske_akademy.jpa.JpaUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic <T> List<T>static PrincipalLooks for principal in CDIstatic Optional<EntityInterface>looks for an EntityInterface in a EntityException or ConstraintViolationException (in the first ConstraintViolation).static jakarta.persistence.EntityManagerFactoryreturn a cached EntityManagerFactory, make sure you close it when it is not needed anymore.
-
Constructor Details
-
JpaUtil
public JpaUtil()
-
-
Method Details
-
getEntityManagerFactory
return a cached EntityManagerFactory, make sure you close it when it is not needed anymore.- Parameters:
name-- Returns:
-
findPrincipal
Looks for principal in CDI- Returns:
- Throws:
IllegalStateException
-
findAll
-
fromException
looks for an EntityInterface in a EntityException or ConstraintViolationException (in the first ConstraintViolation).- Parameters:
ex-- Returns:
- an EntityInterface or empty optional
-