From 4b7e773753ae7b24a3c0c3bdbdd71b8c0d8def5b Mon Sep 17 00:00:00 2001 From: Michael Dick Date: Thu, 4 Jun 2009 18:33:32 +0000 Subject: [PATCH] OPENJPA-1083 Adding trace message git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@781826 13f79535-47bb-0310-9956-ffa450edef68 --- .../org/apache/openjpa/jdbc/schema/ForeignKey.java | 12 ++++++++---- .../org/apache/openjpa/jdbc/sql/DBDictionary.java | 4 ++++ .../apache/openjpa/jdbc/schema/localizer.properties | 2 ++ 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java index 50804ac50..7539123ef 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/schema/ForeignKey.java @@ -18,18 +18,19 @@ */ package org.apache.openjpa.jdbc.schema; -import java.sql.DatabaseMetaData; import java.sql.Connection; +import java.sql.DatabaseMetaData; import java.util.ArrayList; import java.util.Arrays; -import java.util.List; import java.util.LinkedHashMap; +import java.util.List; import org.apache.commons.lang.ObjectUtils; +import org.apache.openjpa.jdbc.sql.DBDictionary; +import org.apache.openjpa.lib.log.Log; import org.apache.openjpa.lib.util.Localizer; import org.apache.openjpa.lib.util.StringDistance; import org.apache.openjpa.util.InvalidStateException; -import org.apache.openjpa.jdbc.sql.DBDictionary; /** * Represents a database foreign key; may be a logical key with no @@ -782,7 +783,10 @@ public class ForeignKey localtable.removeForeignKey(fkTemp); } } catch(Exception ex){ - // TO DO -- It would be nice to log a warning here. + Log log = dbdict.getLog(); + if (log.isTraceEnabled()) { + log.trace(_loc.get("except-read-fk-name"), ex); + } } return retVal; } diff --git a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java index 55c3bc0a3..8078798c1 100644 --- a/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java +++ b/openjpa-jdbc/src/main/java/org/apache/openjpa/jdbc/sql/DBDictionary.java @@ -5020,4 +5020,8 @@ public class DBDictionary return combined; } + + public Log getLog() { + return log; + } } diff --git a/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties b/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties index cd7f846b3..fa7103078 100644 --- a/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties +++ b/openjpa-jdbc/src/main/resources/org/apache/openjpa/jdbc/schema/localizer.properties @@ -152,3 +152,5 @@ conn-failed: Failed to connect to DataSource. Verify Driver "{0}", URL "{1}" \ and connection properties "{2}" are correct. See the nested exception for \ further details. no-column: Can not find column "{0}" in table "{1}" +except-read-fk-name: An exception occurred when obtaining the foreign key \ + names from the database.