Fix [2891561] - ReportCube.update() locks the dataset

https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2891561&group_id=176962
This commit is contained in:
Carlos Ruiz 2009-11-03 23:35:33 +00:00
parent d9b8e0ac72
commit 2d3e729318
2 changed files with 6 additions and 10 deletions

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -25,8 +25,6 @@ import java.util.logging.Level;
import org.adempiere.exceptions.AdempiereException; import org.adempiere.exceptions.AdempiereException;
import org.adempiere.exceptions.DBException; import org.adempiere.exceptions.DBException;
import org.compiere.model.PO;
import org.compiere.model.X_PA_ReportCube;
import org.compiere.util.DB; import org.compiere.util.DB;
import org.compiere.util.KeyNamePair; import org.compiere.util.KeyNamePair;
@ -35,7 +33,7 @@ public class MReportCube extends X_PA_ReportCube {
/** /**
* *
*/ */
private static final long serialVersionUID = 1115698413818333478L; private static final long serialVersionUID = -4771117572936231607L;
public MReportCube(Properties ctx, int PA_ReportCube_ID, String trxName) { public MReportCube(Properties ctx, int PA_ReportCube_ID, String trxName) {
super(ctx, PA_ReportCube_ID, trxName); super(ctx, PA_ReportCube_ID, trxName);
@ -100,7 +98,7 @@ public class MReportCube extends X_PA_ReportCube {
{ {
String lockSQL = "UPDATE PA_ReportCube SET Processing = 'Y' " + String lockSQL = "UPDATE PA_ReportCube SET Processing = 'Y' " +
"WHERE Processing = 'N' AND PA_ReportCube_ID = " + getPA_ReportCube_ID(); "WHERE Processing = 'N' AND PA_ReportCube_ID = " + getPA_ReportCube_ID();
int locked = DB.executeUpdateEx(lockSQL, null); // outside trx int locked = DB.executeUpdateEx(lockSQL, get_TrxName());
if (locked != 1) if (locked != 1)
{ {
throw new AdempiereException("Unable to lock cube for update:" + getName()); throw new AdempiereException("Unable to lock cube for update:" + getName());
@ -224,7 +222,7 @@ public class MReportCube extends X_PA_ReportCube {
"LastRecalculated = " + ( ts == null ? "null" : "?") + "LastRecalculated = " + ( ts == null ? "null" : "?") +
" WHERE PA_ReportCube_ID = " + getPA_ReportCube_ID(); " WHERE PA_ReportCube_ID = " + getPA_ReportCube_ID();
Object[] parameters = ts == null ? new Object[] {} : new Object[] {ts}; Object[] parameters = ts == null ? new Object[] {} : new Object[] {ts};
DB.executeUpdateEx(unlockSQL, parameters, null); // outside trx DB.executeUpdateEx(unlockSQL, parameters, get_TrxName());
} }
return result; return result;
} }

View File

@ -1,5 +1,5 @@
/****************************************************************************** /******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution * * Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. * * Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it * * This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published * * under the terms version 2 of the GNU General Public License as published *
@ -22,7 +22,6 @@ import java.util.logging.Level;
import org.compiere.model.MReportCube; import org.compiere.model.MReportCube;
import org.compiere.model.Query; import org.compiere.model.Query;
import org.compiere.model.X_PA_ReportCube;
/* /*
* Populate Fact_Acct_Summary table with pre-calculated totals of * Populate Fact_Acct_Summary table with pre-calculated totals of
@ -34,7 +33,6 @@ public class FactAcctSummary extends SvrProcess {
private boolean p_reset = false; private boolean p_reset = false;
private int p_Cube_ID = 0; private int p_Cube_ID = 0;
private String periods;
private boolean p_force = false; private boolean p_force = false;
@Override @Override
@ -61,7 +59,7 @@ public class FactAcctSummary extends SvrProcess {
if ( p_Cube_ID > 0) if ( p_Cube_ID > 0)
where = "PA_ReportCube_ID = " + p_Cube_ID; where = "PA_ReportCube_ID = " + p_Cube_ID;
List<MReportCube> cubes = new Query(getCtx(), X_PA_ReportCube.Table_Name, where, get_TrxName()) List<MReportCube> cubes = new Query(getCtx(), MReportCube.Table_Name, where, get_TrxName())
.setOnlyActiveRecords(true).setClient_ID() .setOnlyActiveRecords(true).setClient_ID()
.list(); .list();