public T delegateWork()

in tx-control-providers/jpa/tx-control-provider-jpa-xa-plugin-hibernate-5_0/src/main/java/org/apache/aries/tx/control/jpa/xa/plugin/hibernate/impl/HibernateTxControlPlatform.java [286:311]


		public <T> T delegateWork(WorkExecutorVisitable<T> work, boolean transacted) throws HibernateException {
			Callable<T> c = () -> {
			
				JdbcSessionOwner sessionOwner = owner.getJdbcSessionOwner();
				Connection conn = sessionOwner.getJdbcConnectionAccess().obtainConnection();
				
				try {
					return work.accept(new WorkExecutor<>(), conn);
				} finally {
					sessionOwner.getJdbcConnectionAccess().releaseConnection(conn);
				}
			};
			
			try {
				if(transacted) {
					LOGGER.debug("Performing a query in a nested transaction");
					return getTxControl().requiresNew(c);
				} else {
					LOGGER.debug("Suspending the current transaction to run a query");
					return getTxControl().notSupported(c);
				}
			} finally {
				LOGGER.debug("The previous transaction has been resumed");
			}
				
		}