public abstract class JPAService
extends act.db.sql.SqlDbService
| Modifier and Type | Field and Description |
|---|---|
protected act.db.meta.EntityMetaInfoRepo |
entityMetaInfoRepo |
protected ConcurrentMap<act.db.jpa.JPAService.SQLKey,SQL> |
sqlCache |
| Constructor and Description |
|---|
JPAService(String dbId,
act.app.App app,
Map<String,String> config) |
| Modifier and Type | Method and Description |
|---|---|
protected Class<? extends JPADao> |
baseDaoClass()
Returns the base class of the Dao supported by the JPA service.
|
protected DataSource |
createDataSource() |
protected abstract javax.persistence.EntityManagerFactory |
createEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo)
Create an
EntityManagerFactory using PersistenceUnitInfo. |
protected void |
dataSourceProvided(DataSource dataSource,
act.db.sql.DataSourceConfig dataSourceConfig) |
<DAO extends act.db.Dao> |
defaultDao(Class<?> modelType) |
Class<? extends Annotation> |
entityAnnotationType() |
static JPAService |
findByModelClass(Class<?> modelClass) |
SQL |
getSQL(SQL.Type type,
Class entityClass,
String expression,
String... columns) |
protected <DAO extends act.db.Dao> |
isValidDaoClass(Class<DAO> aClass) |
protected javax.persistence.NamedQuery |
namedQuery(String name) |
protected <ID_TYPE,MODEL_TYPE> |
newDao(Class<ID_TYPE> idType,
Class<MODEL_TYPE> modelType)
Create an new Dao for given id type and model type.
|
<DAO extends act.db.Dao> |
newDaoInstance(Class<DAO> aClass) |
protected abstract Class<? extends javax.persistence.spi.PersistenceProvider> |
persistenceProviderClass()
Returns the class of a
PersistenceProvider implementation. |
protected Properties |
processProperties(Properties properties)
Sub class shall fill in specific properties that are required to build the
PersistenceUnitInfo. |
protected void |
registerNamedQuery(javax.persistence.NamedQuery nq) |
protected boolean |
supportDdl() |
configured, dataSource, dataSourceConfig, dataSourceProvider, dataSourceStatus, executeDdl, fieldNameFromPropertyName, initAsynchronously, initialized, releaseResources, tableNameFromClassName, toStringaddSubResource, destroy, isDestroyed, reload, scopedebug, debug, error, error, fatal, fatal, info, info, isDebugEnabled, isTraceEnabled, trace, trace, warn, warnprotected act.db.meta.EntityMetaInfoRepo entityMetaInfoRepo
protected ConcurrentMap<act.db.jpa.JPAService.SQLKey,SQL> sqlCache
protected void dataSourceProvided(DataSource dataSource, act.db.sql.DataSourceConfig dataSourceConfig)
dataSourceProvided in class act.db.sql.SqlDbServiceprotected DataSource createDataSource()
createDataSource in class act.db.sql.SqlDbServiceprotected boolean supportDdl()
supportDdl in class act.db.sql.SqlDbServicepublic <DAO extends act.db.Dao> DAO defaultDao(Class<?> modelType)
defaultDao in class act.db.DbServicepublic <DAO extends act.db.Dao> DAO newDaoInstance(Class<DAO> aClass)
newDaoInstance in class act.db.DbServicepublic Class<? extends Annotation> entityAnnotationType()
entityAnnotationType in class act.db.DbServiceprotected <ID_TYPE,MODEL_TYPE> JPADao<ID_TYPE,MODEL_TYPE> newDao(Class<ID_TYPE> idType, Class<MODEL_TYPE> modelType)
Create an new Dao for given id type and model type.
ID_TYPE - the generic type of the ID classMODEL_TYPE - the generic type of the model classidType - the type of the ID fieldmodelType - the type of the modelprotected Class<? extends JPADao> baseDaoClass()
Returns the base class of the Dao supported by the JPA service.
protected abstract Class<? extends javax.persistence.spi.PersistenceProvider> persistenceProviderClass()
Returns the class of a PersistenceProvider implementation.
For example a HibernateService shall return HibernatePersistenceProvider.
protected abstract javax.persistence.EntityManagerFactory createEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo persistenceUnitInfo)
Create an EntityManagerFactory using PersistenceUnitInfo.
persistenceUnitInfo - the PersistenceUnitInfoEntityManagerFactory instance.protected <DAO extends act.db.Dao> boolean isValidDaoClass(Class<DAO> aClass)
protected Properties processProperties(Properties properties)
Sub class shall fill in specific properties that are required to build the PersistenceUnitInfo.
For example, a hibernate service might have the following code:
properties.put("javax.persistence.provider", "org.hibernate.ejb.HibernatePersistence");
properties.put(org.hibernate.jpa.AvailableSettings.LOADED_CLASSES, managedClasses);
properties.put("hibernate.dialect", getDefaultDialect(dbConfig, dbConfig.get("db.driver")));
...
return properties;
properties - the properties contains common JPA configurationprotected void registerNamedQuery(javax.persistence.NamedQuery nq)
protected javax.persistence.NamedQuery namedQuery(String name)
public static JPAService findByModelClass(Class<?> modelClass)
Copyright © 2018 ActFramework. All rights reserved.