pu.setClassLoader(classLoader);
try {
ValidatorFactory validatorFactory = null;
final HashMap<String, ValidatorFactory> properties = new HashMap();
ProxyBeanManager proxyBeanManager = null;
// JPA 2.1 sections 3.5.1 + 9.1 require the CDI bean manager to be passed to the peristence provider
// if the persistence unit is contained in a deployment that is a CDI bean archive (has beans.xml).
if (WeldDeploymentMarker.isPartOfWeldDeployment(deploymentUnit)) {
proxyBeanManager = new ProxyBeanManager();
}
final PhaseOnePersistenceUnitServiceImpl service = new PhaseOnePersistenceUnitServiceImpl(classLoader, pu, adaptor, deploymentUnit.getServiceName(), proxyBeanManager);
deploymentUnit.addToAttachmentList(REMOVAL_KEY, new PersistenceAdaptorRemoval(pu, adaptor));