private void setClassLoaderTransformer(DeploymentUnit deploymentUnit) { // (AS7-2233) each persistence unit can use a persistence provider, that might need // to use ClassTransformers. Providers that need class transformers will add them // during the call to CreateContainerEntityManagerFactory. DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); boolean appContainsPersistenceProviderJars = false; // remove when we revert WFLY-10520 if ( transformer != null) { for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) { PersistenceUnitMetadataHolder holder = resourceRoot.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS); if (holder != null) { for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { if (Configuration.needClassFileTransformer(pu)) { transformer.addTransformer(new JPADelegatingClassFileTransformer(pu)); } // remove this check when we revert WFLY-10520 String provider = pu.getProperties().getProperty(Configuration.PROVIDER_MODULE); if (provider != null) { if (provider.equals(Configuration.PROVIDER_MODULE_APPLICATION_SUPPLIED)) { appContainsPersistenceProviderJars = true; } } } } } // WFLY-10520 Add Hibernate ORM 5.3 compatibility transformer if(!appContainsPersistenceProviderJars && hibernate51CompatibilityTransformer) { transformer.addTransformer(Hibernate51CompatibilityTransformer.getInstance()); } } }
private void setClassLoaderTransformer(DeploymentUnit deploymentUnit) { // (AS7-2233) each persistence unit can use a persistence provider, that might need // to use ClassTransformers. Providers that need class transformers will add them // during the call to CreateContainerEntityManagerFactory. DelegatingClassFileTransformer transformer = deploymentUnit.getAttachment(DelegatingClassFileTransformer.ATTACHMENT_KEY); boolean appContainsPersistenceProviderJars = false; // remove when we revert WFLY-10520 if ( transformer != null) { for (ResourceRoot resourceRoot : DeploymentUtils.allResourceRoots(deploymentUnit)) { PersistenceUnitMetadataHolder holder = resourceRoot.getAttachment(PersistenceUnitMetadataHolder.PERSISTENCE_UNITS); if (holder != null) { for (PersistenceUnitMetadata pu : holder.getPersistenceUnits()) { if (Configuration.needClassFileTransformer(pu)) { transformer.addTransformer(new JPADelegatingClassFileTransformer(pu)); } // remove this check when we revert WFLY-10520 String provider = pu.getProperties().getProperty(Configuration.PROVIDER_MODULE); if (provider != null) { if (provider.equals(Configuration.PROVIDER_MODULE_APPLICATION_SUPPLIED)) { appContainsPersistenceProviderJars = true; } } } } } // WFLY-10520 Add Hibernate ORM 5.3 compatibility transformer if(!appContainsPersistenceProviderJars && hibernate51CompatibilityTransformer) { transformer.addTransformer(Hibernate51CompatibilityTransformer.getInstance()); } } }