use of org.hibernate.util.xpl.DTDEntityResolver in project jbosstools-hibernate by jbosstools.
the class ConfigurationFactory method configureStandardConfiguration.
private IConfiguration configureStandardConfiguration(final boolean includeMappings, IConfiguration localCfg, Properties properties) {
if (properties != null) {
localCfg = localCfg.setProperties(properties);
}
EntityResolver entityResolver = new DTDEntityResolver(service);
if (StringHelper.isNotEmpty(prefs.getEntityResolverName())) {
try {
entityResolver = (EntityResolver) ReflectHelper.classForName(prefs.getEntityResolverName()).newInstance();
} catch (Exception c) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_configure_entity_resolver + prefs.getEntityResolverName(), c);
}
}
localCfg.setEntityResolver(entityResolver);
if (StringHelper.isNotEmpty(prefs.getNamingStrategy())) {
try {
INamingStrategy ns = service.newNamingStrategy(prefs.getNamingStrategy());
localCfg.setNamingStrategy(ns);
} catch (Exception c) {
throw new HibernateConsoleRuntimeException(ConsoleMessages.ConsoleConfiguration_could_not_configure_naming_strategy + prefs.getNamingStrategy(), c);
}
}
localCfg = loadConfigurationXML(localCfg, includeMappings, entityResolver);
changeDatasourceProperties(localCfg);
localCfg = configureConnectionProfile(localCfg);
// replace dialect if it is set in preferences
if (StringHelper.isNotEmpty(prefs.getDialectName())) {
localCfg.setProperty(environment.getDialect(), prefs.getDialectName());
}
if (StringHelper.isEmpty(localCfg.getProperty("javax.persistence.validation.mode"))) {
// $NON-NLS-1$
// $NON-NLS-1$//$NON-NLS-2$
localCfg.setProperty("javax.persistence.validation.mode", "none");
}
return localCfg;
}
Aggregations