public class JPAService extends java.lang.Object implements Service, Instrumentable
JPAExecutor.| Modifier and Type | Class and Description |
|---|---|
static class |
JPAService.QueryEntry<E extends java.lang.Enum<E>> |
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
CONF_CONN_DATA_SOURCE |
static java.lang.String |
CONF_CONN_PROPERTIES |
static java.lang.String |
CONF_CREATE_DB_SCHEMA |
static java.lang.String |
CONF_DB_SCHEMA |
static java.lang.String |
CONF_DRIVER |
static java.lang.String |
CONF_MAX_ACTIVE_CONN |
static java.lang.String |
CONF_OPENJPA_BROKER_IMPL |
static java.lang.String |
CONF_PASSWORD |
static java.lang.String |
CONF_PREFIX |
static java.lang.String |
CONF_URL |
static java.lang.String |
CONF_USERNAME |
static java.lang.String |
CONF_VALIDATE_DB_CONN |
static java.lang.String |
CONF_VALIDATE_DB_CONN_EVICTION_INTERVAL |
static java.lang.String |
CONF_VALIDATE_DB_CONN_EVICTION_NUM |
static long |
DEFAULT_INITIAL_WAIT_TIME |
static int |
DEFAULT_MAX_RETRY_COUNT |
static long |
DEFAULT_MAX_WAIT_TIME |
static java.lang.String |
INITIAL_WAIT_TIME |
static java.lang.String |
MAX_RETRY_COUNT |
static java.lang.String |
MAX_WAIT_TIME |
static java.lang.String |
SKIP_COMMIT_FAULT_INJECTION_CLASS |
DEFAULT_LOCK_TIMEOUT, lockTimeout| Constructor and Description |
|---|
JPAService() |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the JPAService
|
<T> T |
execute(JPAExecutor<T> executor)
Execute a
JPAExecutor. |
void |
executeBatchInsertUpdateDelete(java.util.Collection<JsonBean> insertBeans,
java.util.List<JPAService.QueryEntry> updateQueryList,
java.util.Collection<JsonBean> deleteBeans,
javax.persistence.EntityManager em)
Execute multiple update/insert queries in one transaction
|
java.lang.Object |
executeGet(java.lang.String namedQueryName,
javax.persistence.Query query,
javax.persistence.EntityManager em)
Execute a SELECT query
|
java.util.List<?> |
executeGetList(java.lang.String namedQueryName,
javax.persistence.Query query,
javax.persistence.EntityManager em)
Execute a SELECT query to get list of results
|
int |
executeUpdate(java.lang.String namedQueryName,
javax.persistence.Query query,
javax.persistence.EntityManager em)
Execute an UPDATE query
|
javax.persistence.EntityManager |
getEntityManager()
Return an EntityManager.
|
java.lang.Class<? extends Service> |
getInterface()
Return the public interface of the service.
|
void |
init(Services services)
Initializes the
JPAService. |
void |
instrument(Instrumentation instr)
Set the system instrumentation.
|
public static final long DEFAULT_INITIAL_WAIT_TIME
public static final long DEFAULT_MAX_WAIT_TIME
public static final int DEFAULT_MAX_RETRY_COUNT
public static final java.lang.String CONF_DB_SCHEMA
public static final java.lang.String CONF_PREFIX
public static final java.lang.String CONF_URL
public static final java.lang.String CONF_DRIVER
public static final java.lang.String CONF_USERNAME
public static final java.lang.String CONF_PASSWORD
public static final java.lang.String CONF_CONN_DATA_SOURCE
public static final java.lang.String CONF_CONN_PROPERTIES
public static final java.lang.String CONF_MAX_ACTIVE_CONN
public static final java.lang.String CONF_CREATE_DB_SCHEMA
public static final java.lang.String CONF_VALIDATE_DB_CONN
public static final java.lang.String CONF_VALIDATE_DB_CONN_EVICTION_INTERVAL
public static final java.lang.String CONF_VALIDATE_DB_CONN_EVICTION_NUM
public static final java.lang.String CONF_OPENJPA_BROKER_IMPL
public static final java.lang.String INITIAL_WAIT_TIME
public static final java.lang.String MAX_WAIT_TIME
public static final java.lang.String MAX_RETRY_COUNT
public static final java.lang.String SKIP_COMMIT_FAULT_INJECTION_CLASS
public JPAService()
public java.lang.Class<? extends Service> getInterface()
getInterface in interface ServiceJPAService.public void instrument(Instrumentation instr)
Instrumentableinstrument in interface Instrumentableinstr - system instrumentation.public void init(Services services) throws ServiceException
JPAService.init in interface Serviceservices - services instance.ServiceException - thrown if the service could not initialize.public <T> T execute(JPAExecutor<T> executor) throws JPAExecutorException
JPAExecutor.executor - JPAExecutor to execute.JPAExecutorException - thrown if an jpa executor failedpublic int executeUpdate(java.lang.String namedQueryName, javax.persistence.Query query, javax.persistence.EntityManager em) throws JPAExecutorException
namedQueryName - the name of query to be executedquery - query instance to be executedem - Entity ManagerJPAExecutorExceptionpublic void executeBatchInsertUpdateDelete(java.util.Collection<JsonBean> insertBeans, java.util.List<JPAService.QueryEntry> updateQueryList, java.util.Collection<JsonBean> deleteBeans, javax.persistence.EntityManager em) throws JPAExecutorException
insertBeans - list of beans to be insertedupdateQueryList - list of update queriesdeleteBeans - list of beans to be deletedem - Entity ManagerJPAExecutorExceptionpublic java.lang.Object executeGet(java.lang.String namedQueryName, javax.persistence.Query query, javax.persistence.EntityManager em) throws JPAExecutorException
namedQueryName - the name of query to be executedquery - query instance to be executedem - Entity ManagerJPAExecutorExceptionpublic java.util.List<?> executeGetList(java.lang.String namedQueryName, javax.persistence.Query query, javax.persistence.EntityManager em) throws JPAExecutorException
namedQueryName - the name of query to be executedquery - query instance to be executedem - Entity ManagerJPAExecutorExceptionpublic javax.persistence.EntityManager getEntityManager()
Copyright © 2018 Apache Software Foundation. All Rights Reserved.