public void doWork(DsWork work) {
// Flush the EntityManager to make sure we have all entities available
//this.em.flush();
HibernateEntityManagerFactory factory = (HibernateEntityManagerFactory) this.em.unwrap(EntityManagerImpl.class).getEntityManagerFactory();
SessionFactoryImpl sessionFactory = (SessionFactoryImpl) factory.getSessionFactory();
ConnectionProvider connProvider = sessionFactory.getConnectionProvider();
DataSource ds = null;
if (connProvider instanceof DatasourceConnectionProviderImpl) {
ds = ((DatasourceConnectionProviderImpl) connProvider).getDataSource();
logger.debug("Using actual DataSource to execute DataSource work: " + ds);
} else {