Package io.mateu.util.persistence
Class JPAHelper
java.lang.Object
io.mateu.util.persistence.JPAHelper
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidstatic <T> intstatic <T> intstatic <T> voidstatic <T> voiddeleteWithId(javax.persistence.EntityManager em, Class<T> type, Object id) static <T> Tstatic <T> Tstatic <T> Tstatic <T> List<T>static <T> List<T>static IJPAHelperget()static <T> Tstatic <T> List<T>static javax.persistence.EntityManagerFactorygetEMF()static javax.persistence.EntityManagerFactorystatic <T> List<T>nativeSelect(String sql) static ObjectnativeSelectValue(String sql) static voidstatic voidnotransact(JPATransaction t, boolean printException) static voidnotransact(String persistenceUnit, JPATransaction t) static voidnotransact(String persistenceUnit, JPATransaction t, boolean printException) static StringrunNativeSqlUpdate(String sql) static ListselectObjects(String jpql) static ListselectObjects(String jpql, Class targetClass) static ListselectObjects(String jpql, Map<String, Object> params) static Liststatic <T> Optional<T>selectValue(String jpql) static <T> Optional<T>selectValue(String jpql, Map<String, Object> params) static voidset(IJPAHelper i) static voidsetEMF(javax.persistence.EntityManagerFactory f) static intsqlSelectPage(String jpql, int offset, int limit) static voidstatic voidtransact(JPATransaction t, RunnableThrowsThrowable callback) static voidtransact(String persistenceUnit, JPATransaction t) static voidtransact(String persistenceUnit, JPATransaction t, RunnableThrowsThrowable callback) static void
-
Constructor Details
-
JPAHelper
public JPAHelper()
-
-
Method Details
-
get
-
set
-
transact
- Throws:
Throwable
-
transact
- Throws:
Throwable
-
transact
- Throws:
Throwable
-
transact
public static void transact(String persistenceUnit, JPATransaction t, RunnableThrowsThrowable callback) throws Throwable - Throws:
Throwable
-
closeEMFs
public static void closeEMFs() -
setEMF
public static void setEMF(javax.persistence.EntityManagerFactory f) -
getEMF
public static javax.persistence.EntityManagerFactory getEMF() -
getEMF
-
notransact
- Throws:
Throwable
-
notransact
- Throws:
Throwable
-
notransact
- Throws:
Throwable
-
notransact
public static void notransact(String persistenceUnit, JPATransaction t, boolean printException) throws Throwable - Throws:
Throwable
-
find
- Throws:
Throwable
-
findAll
public static <T> List<T> findAll(javax.persistence.EntityManager em, Class<T> type) throws Throwable - Throws:
Throwable
-
findAll
- Throws:
Throwable
-
getAll
-
get
-
selectValue
- Throws:
Throwable
-
selectValue
- Throws:
Throwable
-
selectObjects
- Throws:
Throwable
-
selectObjects
- Throws:
Throwable
-
selectObjects
- Throws:
Throwable
-
selectObjects
public static List selectObjects(String jpql, Map<String, Object> params, Class targetClass) throws Throwable- Throws:
Throwable
-
nativeSelect
- Throws:
Throwable
-
nativeSelectValue
- Throws:
Throwable
-
sqlSelectPage
- Throws:
Throwable
-
sqlCount
- Throws:
Throwable
-
runNativeSqlUpdate
- Throws:
Throwable
-
deleteWithId
-
find
-
find
-
list
-
delete
-
count
-
count
-
update
-