use of org.springframework.orm.jpa.LocalEntityManagerFactoryBean in project camel by apache.
the class JpaEndpoint method createEntityManagerFactory.
protected EntityManagerFactory createEntityManagerFactory() {
LocalEntityManagerFactoryBean emfBean = new LocalEntityManagerFactoryBean();
emfBean.setPersistenceUnitName(persistenceUnit);
emfBean.setJpaPropertyMap(getEntityManagerProperties());
emfBean.afterPropertiesSet();
return emfBean.getObject();
}
use of org.springframework.orm.jpa.LocalEntityManagerFactoryBean in project camel by apache.
the class JpaRouteSharedEntityManagerTest method getBrokerCount.
private int getBrokerCount() {
LocalEntityManagerFactoryBean entityManagerFactory = applicationContext.getBean("&entityManagerFactory", LocalEntityManagerFactoryBean.class);
//uses Spring EL so we don't need to reference the classes
StandardEvaluationContext context = new StandardEvaluationContext(entityManagerFactory);
context.setBeanResolver(new BeanFactoryResolver(applicationContext));
SpelExpressionParser parser = new SpelExpressionParser();
Expression expression = parser.parseExpression("nativeEntityManagerFactory.brokerFactory.openBrokers");
List<?> brokers = expression.getValue(context, List.class);
return brokers.size();
}
Aggregations