From commits-return-2488-apmail-openjpa-commits-archive=openjpa.apache.org@openjpa.apache.org Mon Oct 29 16:23:47 2007 Return-Path: Delivered-To: apmail-openjpa-commits-archive@www.apache.org Received: (qmail 39584 invoked from network); 29 Oct 2007 16:23:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 29 Oct 2007 16:23:47 -0000 Received: (qmail 33912 invoked by uid 500); 29 Oct 2007 16:23:35 -0000 Delivered-To: apmail-openjpa-commits-archive@openjpa.apache.org Received: (qmail 33853 invoked by uid 500); 29 Oct 2007 16:23:35 -0000 Mailing-List: contact commits-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list commits@openjpa.apache.org Received: (qmail 33844 invoked by uid 99); 29 Oct 2007 16:23:34 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2007 09:23:34 -0700 X-ASF-Spam-Status: No, hits=-100.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Oct 2007 16:23:54 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id A39141A9832; Mon, 29 Oct 2007 09:23:23 -0700 (PDT) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit 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 -0000 To: commits@openjpa.apache.org From: kwsutter@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20071029162323.A39141A9832@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org 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://:8889/ 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://:8889/ 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}".