mirror of
https://github.com/hibernate/hibernate-orm
synced 2025-02-16 08:05:05 +00:00
HHH-14356 Have Hibernate Envers produce a user friendly bootstrap exception if xml_mapping_enabled=false
This commit is contained in:
parent
c9ade2affe
commit
92bca8f4f1
@ -9,11 +9,14 @@
|
||||
import java.util.Map;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.MappingException;
|
||||
import org.hibernate.annotations.common.reflection.ReflectionManager;
|
||||
import org.hibernate.boot.registry.classloading.spi.ClassLoaderService;
|
||||
import org.hibernate.boot.spi.MetadataImplementor;
|
||||
import org.hibernate.cfg.AvailableSettings;
|
||||
import org.hibernate.engine.config.spi.ConfigurationService;
|
||||
import org.hibernate.engine.config.spi.StandardConverters;
|
||||
import org.hibernate.envers.configuration.internal.AuditEntitiesConfiguration;
|
||||
import org.hibernate.envers.configuration.internal.EntitiesConfigurator;
|
||||
import org.hibernate.envers.configuration.internal.GlobalConfiguration;
|
||||
@ -36,6 +39,8 @@
|
||||
|
||||
import org.jboss.logging.Logger;
|
||||
|
||||
import static org.hibernate.cfg.AvailableSettings.XML_MAPPING_ENABLED;
|
||||
|
||||
/**
|
||||
* Provides central access to Envers' configuration.
|
||||
*
|
||||
@ -84,6 +89,11 @@ public void configure(Map configurationValues) {
|
||||
);
|
||||
}
|
||||
this.integrationEnabled = ConfigurationHelper.getBoolean( INTEGRATION_ENABLED, configurationValues, true );
|
||||
boolean xmlMappingEnabled = ConfigurationHelper.getBoolean( XML_MAPPING_ENABLED, configurationValues, true );
|
||||
if ( this.integrationEnabled && !xmlMappingEnabled ) {
|
||||
throw new HibernateException( "Hibernate Envers currently requires XML mapping to be enabled. Please don't disable setting `" + XML_MAPPING_ENABLED + "`; alternatively disable Hibernate Envers." );
|
||||
}
|
||||
|
||||
log.infof( "Envers integration enabled? : %s", integrationEnabled );
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user