cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mgen...@apache.org
Subject svn commit: r614559 - in /cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access: DataDomainFlushObserver.java QueryLogger.java
Date Wed, 23 Jan 2008 15:09:27 GMT
Author: mgentry
Date: Wed Jan 23 07:09:21 2008
New Revision: 614559

URL: http://svn.apache.org/viewvc?rev=614559&view=rev
Log:
Added support to log PK values for auto-generated columns per CAY-973.

Modified:
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/QueryLogger.java

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java?rev=614559&r1=614558&r2=614559&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/DataDomainFlushObserver.java
Wed Jan 23 07:09:21 2008
@@ -113,6 +113,9 @@
             if (attribute.isPrimaryKey()) {
                 Object value = key.values().iterator().next();
 
+                // Log the generated PK
+                QueryLogger.logGeneratedKey(attribute, value);
+
                 // I guess we should override any existing value,
                 // as generated key is the latest thing that exists in the DB.
                 id.getReplacementIdMap().put(attribute.getName(), value);

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/QueryLogger.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/QueryLogger.java?rev=614559&r1=614558&r2=614559&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/QueryLogger.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/QueryLogger.java
Wed Jan 23 07:09:21 2008
@@ -245,6 +245,19 @@
         logObj.info("*** Connecting: FAILURE.", th);
     }
 
+    /**
+     * @since 3.0
+     */
+    public static void logGeneratedKey(DbAttribute attribute, Object value)
+    {
+        if (isLoggable()) {
+            String entity = attribute.getEntity().getName();
+            String key    = attribute.getName();
+
+            logObj.info("Generated PK: " + entity + "." + key + " = " + value);
+        }
+    }
+
     private static void buildLog(StringBuffer      buffer,
                                  String            prefix,
                                  String            postfix,



Mime
View raw message