private static EntityManager entityManager(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean emfBean = new LocalContainerEntityManagerFactoryBean();
emfBean.setDataSource(dataSource);
emfBean.setPersistenceUnitName(PERSISTENCE_UNIT_NAME);
emfBean.setPersistenceProviderClass(PERSISTENCE_PROVIDER_CLASS);
emfBean.afterPropertiesSet();
Map map = new HashMap<String, String>();
map.put("openjpa.ConnectionFactoryProperties", "PrintParameters=true");
return emfBean.getObject().createEntityManager(map);
}