You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by bo...@apache.org on 2006/11/21 01:25:47 UTC

svn commit: r477434 - /incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java

Author: boisvert
Date: Mon Nov 20 16:25:46 2006
New Revision: 477434

URL: http://svn.apache.org/viewvc?view=rev&rev=477434
Log:
Guess Hibernate dialect if not specified in hibernate.properties

Modified:
    incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java

Modified: incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java
URL: http://svn.apache.org/viewvc/incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java?view=diff&rev=477434&r1=477433&r2=477434
==============================================================================
--- incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java (original)
+++ incubator/ode/trunk/bpel-store/src/main/java/org/apache/ode/store/dao/ConfStoreConnectionHib.java Mon Nov 20 16:25:46 2006
@@ -43,8 +43,8 @@
     private final SessionFactory _sessionFactory;
     private static TransactionManager _txMgr = null;
 
-    public ConfStoreConnectionHib(DataSource _ds, File appRoot, TransactionManager txMgr) {
-        org.apache.ode.store.dao.ConfStoreConnectionHib._ds = _ds;
+    public ConfStoreConnectionHib(DataSource dataSource, File appRoot, TransactionManager txMgr) {
+        _ds = dataSource;
         _txMgr = txMgr;
         Properties properties = new Properties();
         properties.put(Environment.CONNECTION_PROVIDER, DataSourceConnectionProvider.class.getName());
@@ -56,14 +56,6 @@
             properties.put(Environment.CURRENT_SESSION_CONTEXT_CLASS, "thread");
         }
 
-        try {
-            properties.put(Environment.DIALECT, guessDialect(_ds));
-        } catch (Exception ex) {
-            String errmsg = __msgs.msgOdeInitHibernateDialectDetectFailed();
-            __log.error(errmsg,ex);
-            throw new BpelEngineException(errmsg,ex);
-        }
-
         File hibernatePropFile;
         String confDir = System.getProperty("org.apache.ode.configDir");
         if (confDir != null) hibernatePropFile = new File(confDir, "hibernate.properties");
@@ -82,6 +74,17 @@
             }
         } else {
             __log.info(__msgs.msgOdeInitHibernatePropertiesNotFound(hibernatePropFile));
+        }
+        
+        // Guess Hibernate dialect if not specified in hibernate.properties
+        if (properties.get(Environment.DIALECT) == null) {
+            try {
+                properties.put(Environment.DIALECT, guessDialect(dataSource));
+            } catch (Exception ex) {
+                String errmsg = __msgs.msgOdeInitHibernateDialectDetectFailed();
+                if (__log.isDebugEnabled()) __log.error(errmsg,ex);
+                else __log.error(errmsg);
+            }
         }
 
         _sessionFactory = getDefaultConfiguration().setProperties(properties).buildSessionFactory();