@Service(value="blPersistenceService") public class PersistenceServiceImpl extends Object implements PersistenceService, org.springframework.context.SmartLifecycle
EntityManager or PlatformTransactionManager,
based on a class and TargetModeType. This functionality is
especially useful when multiple PersistenceUnits are in use.
Note: All "default" items reference blPU, which is used to manage most Broadleaf entities in the Admin.| Modifier and Type | Field and Description |
|---|---|
protected Map<String,Map<String,Object>> |
defaultTargetModeMap |
protected static String |
ENTITY_MANAGER_KEY |
protected EntityConfiguration |
entityConfiguration |
protected List<javax.persistence.EntityManager> |
entityManagers |
protected static org.apache.commons.logging.Log |
LOG |
protected List<Map<String,Map<String,Object>>> |
targetModeMaps |
protected static String |
TRANSACTION_MANAGER_KEY |
protected StreamingTransactionCapableUtil |
transUtil |
| Constructor and Description |
|---|
PersistenceServiceImpl() |
| Modifier and Type | Method and Description |
|---|---|
protected String |
buildEJB3ConfigDaoCacheKey(Class<?> clazz) |
protected String |
buildManagerCacheKey(String targetMode,
Class<?> clazz) |
protected String |
buildManagerCacheKey(String targetMode,
String className) |
Class<?> |
getCeilingImplClassFromEntityManagers(String className)
Retrieves the topmost implementation for the given className by checking each registered
EntityManager. |
protected Class<?> |
getClassForName(String className) |
javax.persistence.EntityManager |
getEntityManager(Map<String,Object> managerMap)
Gathers the
EntityManager from the provided managerMap |
protected String |
getManagedClassName(String className) |
int |
getPhase() |
org.springframework.transaction.PlatformTransactionManager |
getTransactionManager(Map<String,Object> managerMap)
Gathers the
PlatformTransactionManager from the provided managerMap |
javax.persistence.EntityManager |
identifyDefaultEntityManager(TargetModeType targetModeType)
Identifies the default
EntityManager for the given targetModeType
NOTE: This assumes that the EntityManager is based on blPU |
org.springframework.transaction.PlatformTransactionManager |
identifyDefaultTransactionManager(TargetModeType targetModeType)
Identifies the default
PlatformTransactionManager for the given targetModeType
NOTE: This assumes that the PlatformTransactionManager is based on blPU |
javax.persistence.EntityManager |
identifyEntityManager(Class entityClass)
Identifies the
EntityManager for the given entityClass, using the default targetModeType of TargetModeType.SANDBOX |
javax.persistence.EntityManager |
identifyEntityManager(Class entityClass,
TargetModeType targetModeType)
Identifies the
EntityManager for the given entityClass and targetModeType |
org.springframework.transaction.PlatformTransactionManager |
identifyTransactionManager(String className,
TargetModeType targetModeType)
Identifies the
PlatformTransactionManager for the given className and targetModeType |
protected void |
initializeEntityManagerCache() |
boolean |
isAutoStartup() |
boolean |
isRunning() |
protected void |
populateCaches(String targetMode,
Map<String,Object> managerMap) |
void |
start() |
void |
stop() |
void |
stop(Runnable callback) |
boolean |
validateEntityClassName(String entityClassName)
Determine if a test class name represents a known entity class registered with Hibernate
|
protected static final org.apache.commons.logging.Log LOG
protected static final String ENTITY_MANAGER_KEY
protected static final String TRANSACTION_MANAGER_KEY
protected EntityConfiguration entityConfiguration
protected StreamingTransactionCapableUtil transUtil
@Autowired protected List<javax.persistence.EntityManager> entityManagers
public boolean isAutoStartup()
isAutoStartup in interface org.springframework.context.SmartLifecyclepublic void stop(Runnable callback)
stop in interface org.springframework.context.SmartLifecyclepublic void start()
start in interface org.springframework.context.Lifecyclepublic void stop()
stop in interface org.springframework.context.Lifecyclepublic boolean isRunning()
isRunning in interface org.springframework.context.Lifecyclepublic int getPhase()
getPhase in interface org.springframework.context.Phasedprotected void initializeEntityManagerCache()
public boolean validateEntityClassName(String entityClassName)
PersistenceServicevalidateEntityClassName in interface PersistenceServicepublic javax.persistence.EntityManager identifyEntityManager(Class entityClass)
PersistenceServiceEntityManager for the given entityClass, using the default targetModeType of TargetModeType.SANDBOXidentifyEntityManager in interface PersistenceServiceEntityManagerpublic javax.persistence.EntityManager identifyEntityManager(Class entityClass, TargetModeType targetModeType)
PersistenceServiceEntityManager for the given entityClass and targetModeTypeidentifyEntityManager in interface PersistenceServiceEntityManagerpublic org.springframework.transaction.PlatformTransactionManager identifyTransactionManager(String className, TargetModeType targetModeType)
PersistenceServicePlatformTransactionManager for the given className and targetModeTypeidentifyTransactionManager in interface PersistenceServicePlatformTransactionManagerpublic javax.persistence.EntityManager identifyDefaultEntityManager(TargetModeType targetModeType)
PersistenceServiceEntityManager for the given targetModeType
NOTE: This assumes that the EntityManager is based on blPUidentifyDefaultEntityManager in interface PersistenceServiceEntityManagerpublic javax.persistence.EntityManager getEntityManager(Map<String,Object> managerMap)
PersistenceServiceEntityManager from the provided managerMapgetEntityManager in interface PersistenceServiceEntityManagerpublic org.springframework.transaction.PlatformTransactionManager identifyDefaultTransactionManager(TargetModeType targetModeType)
PersistenceServicePlatformTransactionManager for the given targetModeType
NOTE: This assumes that the PlatformTransactionManager is based on blPUidentifyDefaultTransactionManager in interface PersistenceServicePlatformTransactionManagerpublic org.springframework.transaction.PlatformTransactionManager getTransactionManager(Map<String,Object> managerMap)
PersistenceServicePlatformTransactionManager from the provided managerMapgetTransactionManager in interface PersistenceServicePlatformTransactionManagerpublic Class<?> getCeilingImplClassFromEntityManagers(String className)
PersistenceServiceEntityManager. If
this is not found in the entity managers, this returns nullgetCeilingImplClassFromEntityManagers in interface PersistenceServiceCopyright © 2019. All rights reserved.