From 1d769eac04a4f6c613f312c4e20fb23f3acf2a29 Mon Sep 17 00:00:00 2001 From: phib Date: Wed, 25 Nov 2009 22:02:15 +0000 Subject: [PATCH] 2904073 MAllocationLine process uses inefficient query https://sourceforge.net/tracker/?func=detail&aid=2904073&group_id=176962&atid=879332 --- base/src/org/compiere/model/MAllocationLine.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/base/src/org/compiere/model/MAllocationLine.java b/base/src/org/compiere/model/MAllocationLine.java index 346bb37c9c..349df3836c 100644 --- a/base/src/org/compiere/model/MAllocationLine.java +++ b/base/src/org/compiere/model/MAllocationLine.java @@ -299,8 +299,8 @@ public class MAllocationLine extends X_C_AllocationLine String update = "UPDATE C_Order o " + "SET C_Payment_ID=" + (reverse ? "NULL " : "(SELECT C_Payment_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ") - + "WHERE EXISTS (SELECT * FROM C_Invoice i " - + "WHERE o.C_Order_ID=i.C_Order_ID AND i.C_Invoice_ID=" + C_Invoice_ID + ")"; + + "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i " + + "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")"; if (DB.executeUpdate(update, get_TrxName()) > 0) log.fine("C_Payment_ID=" + C_Payment_ID + (reverse ? " UnLinked from" : " Linked to") @@ -328,8 +328,8 @@ public class MAllocationLine extends X_C_AllocationLine String update = "UPDATE C_Order o " + "SET C_CashLine_ID=" + (reverse ? "NULL " : "(SELECT C_CashLine_ID FROM C_Invoice WHERE C_Invoice_ID=" + C_Invoice_ID + ") ") - + "WHERE EXISTS (SELECT * FROM C_Invoice i " - + "WHERE o.C_Order_ID=i.C_Order_ID AND i.C_Invoice_ID=" + C_Invoice_ID + ")"; + + "WHERE o.C_Order_ID = (SELECT i.C_Order_ID FROM C_Invoice i " + + "WHERE i.C_Invoice_ID=" + C_Invoice_ID + ")"; if (DB.executeUpdate(update, get_TrxName()) > 0) log.fine("C_CashLine_ID=" + C_CashLine_ID + (reverse ? " UnLinked from" : " Linked to")