OPENJPA-413. Some more clarifications in confusing error messages.

git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@588373 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Patrick Linskey 2007-10-25 22:14:55 +00:00
parent 35fb37ea38
commit b50c73f357
3 changed files with 19 additions and 15 deletions

View File

@ -273,10 +273,8 @@ abstract class AttachStrategy
if (oid != null) if (oid != null)
return manager.getBroker().find(oid, false, null); return manager.getBroker().find(oid, false, null);
} }
throw new UserException(_loc.get("cant-cascade-attach", throw new UserException(_loc.get("cant-cascade-attach", vmd))
Exceptions.toString(toAttach), vmd, .setFailedObject(toAttach);
Exceptions.toString(sm.getManagedInstance()))).
setFailedObject(toAttach);
} }
/** /**

View File

@ -747,10 +747,9 @@ class SingleFieldManager
sm = _broker.getStateManager(obj); sm = _broker.getStateManager(obj);
if (sm == null || !sm.isPersistent()) if (sm == null || !sm.isPersistent())
throw new InvalidStateException(_loc.get("cant-cascade-persist", throw new InvalidStateException(
Exceptions.toString(obj), vmd, _loc.get("cant-cascade-persist", vmd))
Exceptions.toString(_sm.getManagedInstance()))). .setFailedObject(obj);
setFailedObject(obj);
} else { } else {
sm = _broker.getStateManager(obj); sm = _broker.getStateManager(obj);
if (sm == null || !sm.isProvisional()) if (sm == null || !sm.isProvisional())

View File

@ -211,13 +211,20 @@ nontrans-proxied: You cannot make a property access object created with "new" \
nontransactional. nontransactional.
no-field: Field "{0}" is not declared in "{1}", or is not managed. 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}". no-field-index: "{0}" is not the index of any managed field in "{1}".
cant-cascade-persist: Encountered unmanaged object "{0}" in persistent field \ cant-cascade-persist: Encountered unmanaged object in persistent field \
"{1}" of managed object "{2}" during flush. However, this field does not \ "{0}" during flush. However, this field does not \
allow to be CascadeType.PERSIST. You cannot flush unmanaged objects. allow cascade persist. Set the cascade attribute for this field to \
cant-cascade-attach: Encountered new object "{0}" in persistent field \ CascadeType.PERSIST or CascadeType.ALL (JPA annotations) or \
"{1}" of managed object "{2}" during attach. However, this field does not \ "persist" or "all" (JPA orm.xml), or enable cascade-persist globally, \
allow to cascade during attach. You cannot attach a reference to a new object \ or manually persist the related field value prior to flushing. \
without cascading. 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 \ ref-to-deleted: Encountered deleted object "{0}" in persistent field \
"{1}" of managed object "{2}" during flush. "{1}" of managed object "{2}" during flush.
no-version-field: Encountered object "{0}" without a version field during \ no-version-field: Encountered object "{0}" without a version field during \