/** * Determine if class file transformer is needed for the specified persistence unit * * if the persistence provider is Hibernate and use_class_enhancer is not true, don't need a class transformer. * for other persistence providers, the transformer is assumed to be needed. * * @param pu the PU * @return true if class file transformer support is needed for pu */ public static boolean needClassFileTransformer(PersistenceUnitMetadata pu) { boolean result = true; String provider = pu.getPersistenceProviderClassName(); if (pu.getProperties().containsKey(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER)) { result = Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER)); } else if (isHibernateProvider(provider)) { result = (Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_USE_CLASS_ENHANCER)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_DIRTY_TRACKING)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_LAZY_INITIALIZATION)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_ASSOCIATION_MANAGEMENT))); } return result; }
/** * Determine if class file transformer is needed for the specified persistence unit * * if the persistence provider is Hibernate and use_class_enhancer is not true, don't need a class transformer. * for other persistence providers, the transformer is assumed to be needed. * * @param pu the PU * @return true if class file transformer support is needed for pu */ public static boolean needClassFileTransformer(PersistenceUnitMetadata pu) { boolean result = true; String provider = pu.getPersistenceProviderClassName(); if (pu.getProperties().containsKey(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER)) { result = Boolean.parseBoolean(pu.getProperties().getProperty(Configuration.JPA_CONTAINER_CLASS_TRANSFORMER)); } else if (isHibernateProvider(provider)) { result = (Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_USE_CLASS_ENHANCER)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_DIRTY_TRACKING)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_LAZY_INITIALIZATION)) || Boolean.TRUE.toString().equals(pu.getProperties().getProperty(HIBERNATE_ENABLE_ASSOCIATION_MANAGEMENT))); } return result; }