Author: dgeraskov
Date: 2010-12-14 05:21:22 -0500 (Tue, 14 Dec 2010)
New Revision: 27437
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-7884
Set Validation mode to none for all console configuration types.
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-14
10:00:27 UTC (rev 27436)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2010-12-14
10:21:22 UTC (rev 27437)
@@ -156,10 +156,15 @@
// TODO: delegate to some extension point
private Configuration buildConfiguration(Properties properties, boolean includeMappings)
{
Configuration localCfg = null;
+ Properties overrides = new Properties();
+ overrides.put("javax.persistence.validation.mode", "none");
//$NON-NLS-1$//$NON-NLS-2$
+ if (properties != null) {
+ overrides.putAll(properties);
+ }
if (prefs.getConfigurationMode().equals(ConfigurationMode.ANNOTATIONS)) {
try {
localCfg = buildAnnotationConfiguration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -170,7 +175,7 @@
} else if (prefs.getConfigurationMode().equals(ConfigurationMode.JPA)) {
try {
localCfg = buildJPAConfiguration(getPreferences().getPersistenceUnitName(),
- properties, prefs.getEntityResolverName(), includeMappings);
+ overrides, prefs.getEntityResolverName(), includeMappings);
} catch (HibernateConsoleRuntimeException he) {
throw he;
} catch (Exception e) {
@@ -179,7 +184,7 @@
}
} else {
localCfg = new Configuration();
- localCfg = configureStandardConfiguration(includeMappings, localCfg, properties);
+ localCfg = configureStandardConfiguration(includeMappings, localCfg, overrides);
}
return localCfg;
}
@@ -200,9 +205,8 @@
}
try {
Map<Object, Object> overrides = new HashMap<Object, Object>();
- if (properties != null) {
- overrides.putAll(properties);
- }
+ overrides.putAll(properties);
+
if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
overrides.put("hibernate.ejb.naming_strategy", prefs.getNamingStrategy());
//$NON-NLS-1$
}
@@ -212,9 +216,6 @@
if (!includeMappings) {
overrides.put("hibernate.archive.autodetection", "none");
//$NON-NLS-1$//$NON-NLS-2$
}
- if (StringHelper.isEmpty((String)
overrides.get("javax.persistence.validation.mode"))) {//$NON-NLS-1$
- overrides.put("javax.persistence.validation.mode", "none");
//$NON-NLS-1$//$NON-NLS-2$
- }
Class<?> clazz = ReflectHelper.classForName(
"org.hibernate.ejb.Ejb3Configuration", ConsoleConfiguration.class);
//$NON-NLS-1$
Object ejb3cfg = clazz.newInstance();
@@ -247,9 +248,8 @@
private Configuration configureStandardConfiguration(final boolean includeMappings,
Configuration localCfg, Properties properties) {
- if (properties != null) {
- localCfg = localCfg.setProperties(properties);
- }
+ localCfg = localCfg.setProperties(properties);
+
EntityResolver entityResolver = XMLHelper.DEFAULT_DTD_RESOLVER;
if (StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
try {