openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kwsut...@apache.org
Subject svn commit: r589723 - in /openjpa: branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/ trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ t...
Date Mon, 29 Oct 2007 16:23:18 GMT
Author: kwsutter
Date: Mon Oct 29 09:23:17 2007
New Revision: 589723

URL: http://svn.apache.org/viewvc?rev=589723&view=rev
Log:
OPENJPA-421.  Committing Daniel's changes to ensure that the datasource configuration is complete
before attempting to generate SQL.

Modified:
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
    openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
    openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?rev=589723&r1=589722&r2=589723&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
Mon Oct 29 09:23:17 2007
@@ -189,6 +189,7 @@
         DataSource inner = ds.getInnermostDelegate();
         if (inner instanceof DriverDataSource)
             ((DriverDataSource) inner).initDBDictionary(dict);
+        Connection conn = null;
 
         try {
             // add the dictionary as a warning handler on the logging
@@ -219,9 +220,26 @@
 
             // allow the dbdictionary to decorate the connection further
             ds.addDecorator(dict);
+            
+            // ensure dbdictionary to process connectedConfiguration()
+            if (!factory2)
+                conn = ds.getConnection(conf.getConnectionUserName(), conf
+                        .getConnectionPassword());
+            else
+                conn = ds.getConnection(conf.getConnection2UserName(), conf
+                        .getConnection2Password());
+
             return ds;
         } catch (Exception e) {
             throw new StoreException(e).setFatal(true);
+        } finally {
+            if (conn != null)
+                try {
+                    conn.close();
+                } catch (SQLException se) {
+                    // ignore any exception since the connection is not going
+                    // to be used anyway
+                }
         }
     }
 

Modified: openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties?rev=589723&r1=589722&r2=589723&view=diff
==============================================================================
--- openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
(original)
+++ openjpa/branches/1.0.x/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
Mon Oct 29 09:23:17 2007
@@ -238,8 +238,8 @@
 	jdbc:dbaw://<hostname>:8889/<database>
 
 connecting-for-dictionary: OpenJPA will now connect to the database to attempt \
-    to determine what type of database dictionary to use.  To prevent this \
-	connection in the future, set your openjpa.jdbc.DBDictionary \
+    to determine what type of database dictionary to use. You may prevent this \
+	connection in the future by setting your openjpa.jdbc.DBDictionary \
     configuration property to the appropriate value for your database (see \
     the documentation for available values).
 map-factory: Using mapping factory "{0}".

Modified: openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java?rev=589723&r1=589722&r2=589723&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/DataSourceFactory.java
Mon Oct 29 09:23:17 2007
@@ -189,6 +189,7 @@
         DataSource inner = ds.getInnermostDelegate();
         if (inner instanceof DriverDataSource)
             ((DriverDataSource) inner).initDBDictionary(dict);
+        Connection conn = null;
 
         try {
             // add the dictionary as a warning handler on the logging
@@ -219,9 +220,26 @@
 
             // allow the dbdictionary to decorate the connection further
             ds.addDecorator(dict);
+            
+            // ensure dbdictionary to process connectedConfiguration()
+            if (!factory2)
+                conn = ds.getConnection(conf.getConnectionUserName(), conf
+                        .getConnectionPassword());
+            else
+                conn = ds.getConnection(conf.getConnection2UserName(), conf
+                        .getConnection2Password());
+
             return ds;
         } catch (Exception e) {
             throw new StoreException(e).setFatal(true);
+        } finally {
+            if (conn != null)
+                try {
+                    conn.close();
+                } catch (SQLException se) {
+                    // ignore any exception since the connection is not going
+                    // to be used anyway
+                }
         }
     }
 

Modified: openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties?rev=589723&r1=589722&r2=589723&view=diff
==============================================================================
--- openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
(original)
+++ openjpa/trunk/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/conf/localizer.properties
Mon Oct 29 09:23:17 2007
@@ -238,8 +238,8 @@
 	jdbc:dbaw://<hostname>:8889/<database>
 
 connecting-for-dictionary: OpenJPA will now connect to the database to attempt \
-    to determine what type of database dictionary to use.  To prevent this \
-	connection in the future, set your openjpa.jdbc.DBDictionary \
+    to determine what type of database dictionary to use. You may prevent this \
+	connection in the future by setting your openjpa.jdbc.DBDictionary \
     configuration property to the appropriate value for your database (see \
     the documentation for available values).
 map-factory: Using mapping factory "{0}".



Mime
View raw message