mirror of https://github.com/apache/openjpa.git
OPENJPA-343. Modified the call to setRollbackOnly to check for a valid Transaction status first. If the Transaction is not in a valid state, then we will log a trace message indicating such failure. Processing will continue though.
git-svn-id: https://svn.apache.org/repos/asf/openjpa/trunk@571523 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
4dae2231cc
commit
8500feee82
|
@ -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) {
|
||||
|
|
|
@ -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.
|
Loading…
Reference in New Issue