You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openjpa.apache.org by cu...@apache.org on 2011/01/04 19:01:05 UTC

svn commit: r1055122 - in /openjpa/branches/2.1.x: openjpa-kernel/src/main/java/org/apache/openjpa/kernel/ openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/

Author: curtisr7
Date: Tue Jan  4 18:01:05 2011
New Revision: 1055122

URL: http://svn.apache.org/viewvc?rev=1055122&view=rev
Log:
OPENJPA-1911: fix merge problem for entities with derived id

Added:
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/
      - copied from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java
      - copied, changed from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java
      - copied, changed from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java
      - copied, changed from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java
    openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java
      - copied, changed from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java
Modified:
    openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java

Modified: openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java?rev=1055122&r1=1055121&r2=1055122&view=diff
==============================================================================
--- openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java (original)
+++ openjpa/branches/2.1.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/StateManagerImpl.java Tue Jan  4 18:01:05 2011
@@ -1999,9 +1999,25 @@ public class StateManagerImpl
                     case JavaTypes.ARRAY:
                     case JavaTypes.COLLECTION:
                     case JavaTypes.MAP:
-                    case JavaTypes.PC:
                     case JavaTypes.PC_UNTYPED:
                         break;
+                    case JavaTypes.PC:
+                        if (_meta.getField(field).isPrimaryKey()) {
+                            // this field is a derived identity
+                            //if (newVal != null && newVal.equals(curVal))
+                            //    return;
+                            //else {
+                                if (curVal != null && newVal != null && 
+                                    curVal instanceof PersistenceCapable && newVal instanceof PersistenceCapable) {
+                                    PersistenceCapable curPc = (PersistenceCapable) curVal;
+                                    PersistenceCapable newPc = (PersistenceCapable) newVal;
+                                    if (curPc.pcFetchObjectId().equals(newPc.pcFetchObjectId()))
+                                        return;
+                                    
+                                }
+                            //}
+                        } else     
+                            break;
                     default:
                         if (newVal != null && newVal.equals(curVal))
                             return;

Copied: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java (from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java?p2=openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java&r1=1054717&r2=1055122&rev=1055122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java (original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchy.java Tue Jan  4 18:01:05 2011
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
 package org.apache.openjpa.persistence.xs;
 
 import java.io.Serializable;

Copied: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java (from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java?p2=openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java&r1=1054717&r2=1055122&rev=1055122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java (original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRate.java Tue Jan  4 18:01:05 2011
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
 package org.apache.openjpa.persistence.xs;
 
 import java.io.Serializable;

Copied: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java (from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java?p2=openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java&r1=1054717&r2=1055122&rev=1055122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java (original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/AccountingHierarchyRateOpenJPAKey.java Tue Jan  4 18:01:05 2011
@@ -1,9 +1,26 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
 package org.apache.openjpa.persistence.xs;
 
 import java.io.Serializable;
 
 /**
- * Application identity class for: lk.informatics.infotrack.model.entity.AccountingHierarchyRate
  *
  * Auto-generated by:
  * org.apache.openjpa.enhance.ApplicationIdTool

Copied: openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java (from r1054717, openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java)
URL: http://svn.apache.org/viewvc/openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java?p2=openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java&p1=openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java&r1=1054717&r2=1055122&rev=1055122&view=diff
==============================================================================
--- openjpa/trunk/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java (original)
+++ openjpa/branches/2.1.x/openjpa-persistence-jdbc/src/test/java/org/apache/openjpa/persistence/xs/TestMergeComplexKey.java Tue Jan  4 18:01:05 2011
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
 package org.apache.openjpa.persistence.xs;
 
 import java.math.BigDecimal;