Author: dgeraskov
Date: 2012-02-13 09:17:08 -0500 (Mon, 13 Feb 2012)
New Revision: 38655
Modified:
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10507
Overwrite datasource properties on configuration build
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 2012-02-13
14:07:20 UTC (rev 38654)
+++
trunk/hibernatetools/plugins/org.hibernate.eclipse/src/org/hibernate/console/ConfigurationFactory.java 2012-02-13
14:17:08 UTC (rev 38655)
@@ -82,15 +82,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean
includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class",
"");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER,
"org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -382,10 +385,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-13
14:07:20 UTC (rev 38654)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate3_6/src/org/jboss/tools/hibernate3_6/ConfigurationFactory.java 2012-02-13
14:17:08 UTC (rev 38655)
@@ -74,15 +74,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean
includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class",
"");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER,
"org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -374,10 +377,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
===================================================================
---
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-13
14:07:20 UTC (rev 38654)
+++
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2012-02-13
14:17:08 UTC (rev 38655)
@@ -86,15 +86,18 @@
public Configuration createConfiguration(Configuration localCfg, boolean
includeMappings) {
Properties properties = prefs.getProperties();
- if (properties != null) {
- // in case the transaction manager is empty then we need to inject a faketm since
- // hibernate will still try and instantiate it.
- String str = properties.getProperty(Environment.TRANSACTION_MANAGER_STRATEGY);
- if (str != null && StringHelper.isEmpty(str)) {
- properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
- // properties.setProperty( "hibernate.transaction.factory_class",
"");
- }
+ //https://issues.jboss.org/browse/JBIDE-10507
+ //overwrite datasource properties
+ if (properties == null) {
+ properties = new Properties();
}
+
+ // in case the transaction manager is empty then we need to inject a faketm since
+ // hibernate will still try to instantiate it.
+ properties.setProperty(Environment.TRANSACTION_MANAGER_STRATEGY, FAKE_TM_LOOKUP);
+ properties.put(Environment.DATASOURCE, ""); //$NON-NLS-1$
+ properties.put(Environment.CONNECTION_PROVIDER,
"org.hibernate.connection.DriverManagerConnectionProvider"); //$NON-NLS-1$
+
if (localCfg == null) {
localCfg = buildConfiguration(properties, includeMappings);
} else {
@@ -390,10 +393,6 @@
connProfileName);
if (profile != null) {
final Properties cpProperties = profile.getProperties(profile.getProviderId());
- final Properties invokeProperties = localCfg.getProperties();
- // set this property to null!
- invokeProperties.remove(Environment.DATASOURCE);
- localCfg.setProperties(invokeProperties);
// seems we should not setup dialect here
//String dialect = "org.hibernate.dialect.HSQLDialect";
//invoke.setProperty(Environment.DIALECT, dialect);