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

svn commit: r940904 - in /openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main: java/org/apache/openjpa/kernel/BrokerImpl.java resources/org/apache/openjpa/kernel/localizer.properties

Author: mikedd
Date: Tue May  4 15:19:13 2010
New Revision: 940904

URL: http://svn.apache.org/viewvc?rev=940904&view=rev
Log:
Include existing entity and new entity in EntityExistsException message

Modified:
    openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
    openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties

Modified: openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java?rev=940904&r1=940903&r2=940904&view=diff
==============================================================================
--- openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java (original)
+++ openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/BrokerImpl.java Tue May  4 15:19:13 2010
@@ -2392,9 +2392,15 @@ public class BrokerImpl
 
             // make sure we don't already have the instance cached
             StateManagerImpl other = getStateManagerImplById(id, false);
-            if (other != null && !other.isDeleted() && !other.isNew())
-                throw new ObjectExistsException(_loc.get("cache-exists",
-                    obj.getClass().getName(), id)).setFailedObject(obj);
+            if (other != null && !other.isDeleted() && !other.isNew()) {
+                throw new ObjectExistsException(_loc.get("cache-exists", 
+                    new Object[] {
+                        obj.getClass().getName(),
+                        id,
+                        other.getPersistenceCapable(),
+                        obj }
+                )).setFailedObject(obj);
+            }
 
             // if had embedded sm, null it
             if (sm != null)

Modified: openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties?rev=940904&r1=940903&r2=940904&view=diff
==============================================================================
--- openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties (original)
+++ openjpa/sandboxes/OpenJPA-1551-1.0.x/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties Tue May  4 15:19:13 2010
@@ -130,7 +130,8 @@ changed-oid: You have modified the objec
 	was "{0}", and its new value is "{1}".  Object id fields are immutable \
 	once the object id of the instance has been assigned. 
 cache-exists: An object of type "{0}" with oid "{1}" already exists in this \
-	context; another cannot be persisted.
+	context; another cannot be persisted. Instance which currently exists: "{2}" \
+	Instance which was attempted to be persisted: "{3}"
 null-trans: Attempt to commit a null javax.transaction.Transaction.  Some \
 	application servers set the transaction to null if a rollback occurs.
 end-trans-error: An exception occurred while ending the transaction.  This \