cayenne-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aadamc...@apache.org
Subject svn commit: r928488 - in /cayenne/main/trunk: docs/doc/src/main/resources/RELEASE-NOTES.txt framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
Date Sun, 28 Mar 2010 19:54:48 GMT
Author: aadamchik
Date: Sun Mar 28 19:54:48 2010
New Revision: 928488

URL: http://svn.apache.org/viewvc?rev=928488&view=rev
Log:
CAY-1409 Pkgenerator is accessed needlessly for join tables with own database generated PK

Modified:
    cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
    cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java

Modified: cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt?rev=928488&r1=928487&r2=928488&view=diff
==============================================================================
--- cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt (original)
+++ cayenne/main/trunk/docs/doc/src/main/resources/RELEASE-NOTES.txt Sun Mar 28 19:54:48 2010
@@ -61,6 +61,7 @@ CAY-1397 ROP: Missing the COMMIT state w
 CAY-1400 lazyInitParentDomainName will become null when using Child Context
 CAY-1401 Cache group removed from modeler query
 CAY-1404 ClassCastException during ObjectDetachOperation
+CAY-1409 Pkgenerator is accessed needlessly for join tables with own database generated PK
 
 ----------------------------------
 Release: 3.0 RC 2

Modified: cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
URL: http://svn.apache.org/viewvc/cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java?rev=928488&r1=928487&r2=928488&view=diff
==============================================================================
--- cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
(original)
+++ cayenne/main/trunk/framework/cayenne-jdk1.5-unpublished/src/main/java/org/apache/cayenne/access/FlattenedArcKey.java
Sun Mar 28 19:54:48 2010
@@ -29,7 +29,7 @@ import org.apache.cayenne.CayenneRuntime
 import org.apache.cayenne.ObjectId;
 import org.apache.cayenne.access.DataDomainSyncBucket.PropagatedValueFactory;
 import org.apache.cayenne.access.util.DefaultOperationObserver;
-import org.apache.cayenne.dba.PkGenerator;
+import org.apache.cayenne.dba.DbAdapter;
 import org.apache.cayenne.map.DbAttribute;
 import org.apache.cayenne.map.DbEntity;
 import org.apache.cayenne.map.DbJoin;
@@ -112,6 +112,14 @@ final class FlattenedArcKey {
                 continue;
             }
 
+            DbAdapter adapter = node.getAdapter();
+
+            // skip db-generated... looks like we don't care about the actual PK value
+            // here, so no need to retrieve db-generated pk back to Java.
+            if (adapter.supportsGeneratedKeys() && dbAttr.isGenerated()) {
+                continue;
+            }
+
             if (autoPkDone) {
                 throw new CayenneRuntimeException(
                         "Primary Key autogeneration only works for a single attribute.");
@@ -119,8 +127,7 @@ final class FlattenedArcKey {
 
             // finally, use database generation mechanism
             try {
-                PkGenerator pkGenerator = node.getAdapter().getPkGenerator();
-                Object pkValue = pkGenerator.generatePk(node, dbAttr);
+                Object pkValue = adapter.getPkGenerator().generatePk(node, dbAttr);
                 snapshot.put(dbAttrName, pkValue);
                 autoPkDone = true;
             }



Mime
View raw message