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)
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);
}
/**

View File

@ -747,10 +747,9 @@ class SingleFieldManager
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())

View File

@ -211,13 +211,20 @@ nontrans-proxied: You cannot make a property access object created with "new" \
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 \