OPENJPA-343 merging to 1.0.x. Original changes under rev 571523

git-svn-id: https://svn.apache.org/repos/asf/openjpa/branches/1.0.x@577077 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Michael Dick 2007-09-18 21:47:53 +00:00
parent 1e726bdbfc
commit aece331d8a
2 changed files with 11 additions and 1 deletions

View File

@ -1430,7 +1430,15 @@ public class BrokerImpl
_runtime.getTransactionManager().getTransaction();
if (trans == null)
throw new InvalidStateException(_loc.get("null-trans"));
_runtime.setRollbackOnly(cause);
// ensure tran is in a valid state to accept the setRollbackOnly
int tranStatus = trans.getStatus();
if ((tranStatus != Status.STATUS_NO_TRANSACTION)
&& (tranStatus != Status.STATUS_ROLLEDBACK)
&& (tranStatus != Status.STATUS_COMMITTED))
_runtime.setRollbackOnly(cause);
else if (_log.isTraceEnabled())
_log.trace(_loc.get("invalid-tran-status", new Integer(
tranStatus), "setRollbackOnly"));
} catch (OpenJPAException ke) {
throw ke;
} catch (Exception e) {

View File

@ -373,3 +373,5 @@ existing value assigned to this field: {0}. This existing value was either \
provided via an initializer or by calling the setter method. You either need \
to remove the @GeneratedValue annotation or modify the code to remove the \
initializer processing.
invalid-tran-status: The transaction was not in a valid state ({0}) to \
accept the "{1}" method invocation. Processing will continue.