openjpa-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From p..@apache.org
Subject svn commit: r588373 - in /openjpa/trunk/openjpa-kernel/src/main: java/org/apache/openjpa/kernel/AttachStrategy.java java/org/apache/openjpa/kernel/SingleFieldManager.java resources/org/apache/openjpa/kernel/localizer.properties
Date Thu, 25 Oct 2007 22:14:56 GMT
Author: pcl
Date: Thu Oct 25 15:14:55 2007
New Revision: 588373

URL: http://svn.apache.org/viewvc?rev=588373&view=rev
Log:
OPENJPA-413. Some more clarifications in confusing error messages.

Modified:
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
    openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
    openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java?rev=588373&r1=588372&r2=588373&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/AttachStrategy.java
Thu Oct 25 15:14:55 2007
@@ -273,10 +273,8 @@
             if (oid != null)
                 return manager.getBroker().find(oid, false, null);
         }
-        throw new UserException(_loc.get("cant-cascade-attach",
-            Exceptions.toString(toAttach), vmd,
-            Exceptions.toString(sm.getManagedInstance()))).
-            setFailedObject(toAttach);
+        throw new UserException(_loc.get("cant-cascade-attach", vmd))
+            .setFailedObject(toAttach);
     }
 
     /**

Modified: openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java?rev=588373&r1=588372&r2=588373&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/java/org/apache/openjpa/kernel/SingleFieldManager.java
Thu Oct 25 15:14:55 2007
@@ -747,10 +747,9 @@
 
             sm = _broker.getStateManager(obj);
             if (sm == null || !sm.isPersistent())
-                throw new InvalidStateException(_loc.get("cant-cascade-persist",
-                    Exceptions.toString(obj), vmd,
-                    Exceptions.toString(_sm.getManagedInstance()))).
-                    setFailedObject(obj);
+                throw new InvalidStateException(
+                    _loc.get("cant-cascade-persist", vmd))
+                    .setFailedObject(obj);
         } else {
             sm = _broker.getStateManager(obj);
             if (sm == null || !sm.isProvisional())

Modified: openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
URL: http://svn.apache.org/viewvc/openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties?rev=588373&r1=588372&r2=588373&view=diff
==============================================================================
--- openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
(original)
+++ openjpa/trunk/openjpa-kernel/src/main/resources/org/apache/openjpa/kernel/localizer.properties
Thu Oct 25 15:14:55 2007
@@ -211,13 +211,20 @@
 	nontransactional.
 no-field: Field "{0}" is not declared in "{1}", or is not managed.
 no-field-index: "{0}" is not the index of any managed field in "{1}".
-cant-cascade-persist: Encountered unmanaged object "{0}" in persistent field \
-	"{1}" of managed object "{2}" during flush.  However, this field does not \
-	allow to be CascadeType.PERSIST.  You cannot flush unmanaged objects.
-cant-cascade-attach: Encountered new object "{0}" in persistent field \
-	"{1}" of managed object "{2}" during attach.  However, this field does not \
-	allow to cascade during attach.  You cannot attach a reference to a new object \
-	without cascading.
+cant-cascade-persist: Encountered unmanaged object in persistent field \
+	"{0}" during flush.  However, this field does not \
+	allow cascade persist. Set the cascade attribute for this field to \
+    CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or \
+    "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, \
+    or manually persist the related field value prior to flushing. \
+	You cannot flush unmanaged objects or graphs that have persistent \
+    associations to unmanaged objects.
+cant-cascade-attach: Encountered new object in persistent field \
+	"{0}" during attach.  However, this field does not \
+	allow cascade attach. Set the cascade attribute for this field to \
+    CascadeType.MERGE or CascadeType.ALL (JPA annotations) or \
+    "merge" or "all" (JPA orm.xml). \
+    You cannot attach a reference to a new object without cascading.
 ref-to-deleted: Encountered deleted object "{0}" in persistent field \
 	"{1}" of managed object "{2}" during flush.
 no-version-field: Encountered object "{0}" without a version field during \



Mime
View raw message