From 41235d67e2963a7362096075dac45e8727cdde98 Mon Sep 17 00:00:00 2001 From: teo_sarca Date: Tue, 8 Sep 2009 09:47:23 +0000 Subject: [PATCH] BF [ 2849122 ] PO.AfterSave is not rollback on error https://sourceforge.net/tracker/?func=detail&aid=2849122&group_id=176962&atid=879332 Using a trx that was previously closed or never opened Creating and starting the transaction right here, but please note that this is not a good practice --- base/src/org/compiere/model/PO.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/base/src/org/compiere/model/PO.java b/base/src/org/compiere/model/PO.java index 05707b60b2..b4dcbca24a 100644 --- a/base/src/org/compiere/model/PO.java +++ b/base/src/org/compiere/model/PO.java @@ -1954,6 +1954,14 @@ public abstract class PO else { trx = Trx.get(m_trxName, false); + if (trx == null) + { + // Using a trx that was previously closed or never opened + // Creating and starting the transaction right here, but please note + // that this is not a good practice + trx = Trx.get(m_trxName, true); + log.warning("Transaction closed or never opened ("+m_trxName+") => starting now"); + } } // Before Save