public abstract class JpaSupport extends Object
| Modifier and Type | Class and Description |
|---|---|
protected static interface |
JpaSupport.JDBCTask
The jdbc task interface.
|
| Constructor and Description |
|---|
JpaSupport() |
| Modifier and Type | Method and Description |
|---|---|
protected <T extends Model> |
all(Class<T> modelClass)
Get the
Query instance for the given model class. |
protected EntityManager |
getEntityManager()
Get the instance of current
EntityManager. |
protected void |
inTransaction(Runnable task)
Run the given task inside a transaction that is committed after the task
is completed.
|
protected void |
jdbcTask(JpaSupport.JDBCTask task)
Perform JDBC related task using the
Connection managed by the
current EntityManager. |
protected EntityManager getEntityManager()
EntityManager.EntityManager instanceprotected <T extends Model> Query<T> all(Class<T> modelClass)
Query instance for the given model class.T - the type of the modelmodelClass - the model classQueryprotected void inTransaction(Runnable task)
task - the task to runprotected void jdbcTask(JpaSupport.JDBCTask task)
Connection managed by the
current EntityManager.task - The task to be performedPersistenceException - Generally indicates wrapped SQLException