use of org.broadleafcommerce.common.util.dao.EJB3ConfigurationDao in project BroadleafCommerce by BroadleafCommerce.
the class PersistenceManagerImpl method configureDefaultDynamicEntityDao.
@Override
public void configureDefaultDynamicEntityDao(TargetModeType targetModeType) {
EntityManager entityManager = getDefaultEntityManager(targetModeType);
dynamicEntityDao.setStandardEntityManager(entityManager);
EJB3ConfigurationDao ejb3ConfigurationDao = getDefaultEJB3ConfigurationDao(targetModeType);
dynamicEntityDao.setEjb3ConfigurationDao(ejb3ConfigurationDao);
}
use of org.broadleafcommerce.common.util.dao.EJB3ConfigurationDao in project BroadleafCommerce by BroadleafCommerce.
the class PersistenceManagerImpl method configureDynamicEntityDao.
@Override
public void configureDynamicEntityDao(Class entityClass, TargetModeType targetModeType) {
EntityManager entityManager = getEntityManager(entityClass, targetModeType);
dynamicEntityDao.setStandardEntityManager(entityManager);
EJB3ConfigurationDao ejb3ConfigurationDao = getEJB3ConfigurationDao(entityClass);
dynamicEntityDao.setEjb3ConfigurationDao(ejb3ConfigurationDao);
}
use of org.broadleafcommerce.common.util.dao.EJB3ConfigurationDao in project BroadleafCommerce by BroadleafCommerce.
the class PersistenceServiceImpl method populateCaches.
protected void populateCaches(String targetMode, Map<String, Object> managerMap) {
final EntityManager em = getEntityManager(managerMap);
final PlatformTransactionManager txManager = getTransactionManager(managerMap);
final EJB3ConfigurationDao ejb3ConfigurationDao = getEJB3ConfigurationDao(managerMap);
SessionFactory sessionFactory = em.unwrap(Session.class).getSessionFactory();
for (Object item : sessionFactory.getAllClassMetadata().values()) {
ClassMetadata metadata = (ClassMetadata) item;
Class<?> mappedClass = metadata.getMappedClass();
String managerCacheKey = buildManagerCacheKey(targetMode, mappedClass);
ENTITY_MANAGER_CACHE.put(managerCacheKey, em);
TRANSACTION_MANAGER_CACHE.put(managerCacheKey, txManager);
String ejb3ConfigDaoCacheKey = buildEJB3ConfigDaoCacheKey(mappedClass);
if (!EJB3_CONFIG_DAO_CACHE.containsKey(ejb3ConfigDaoCacheKey)) {
EJB3_CONFIG_DAO_CACHE.put(ejb3ConfigDaoCacheKey, ejb3ConfigurationDao);
}
}
}
use of org.broadleafcommerce.common.util.dao.EJB3ConfigurationDao in project BroadleafCommerce by BroadleafCommerce.
the class PersistenceServiceImpl method identifyEJB3ConfigurationDao.
@Override
public EJB3ConfigurationDao identifyEJB3ConfigurationDao(Class entityClass) {
String cacheKey = buildEJB3ConfigDaoCacheKey(entityClass);
EJB3ConfigurationDao ejb3ConfigurationDao = EJB3_CONFIG_DAO_CACHE.get(cacheKey);
if (ejb3ConfigurationDao == null) {
throw new RuntimeException("Unable to determine the EJB3ConfigurationDao for the following class: " + entityClass.getName());
}
return ejb3ConfigurationDao;
}
Aggregations