IDEMPIERE-3162:infoPanel:postgresql need trx to use cursor based resultset

This commit is contained in:
hieplq 2016-08-17 23:53:56 +07:00
parent eb6c1f4347
commit 0d78b00ce2
2 changed files with 7 additions and 1 deletions

View File

@ -3543,6 +3543,7 @@ public class GridTable extends AbstractTableModel
private void openResultSet() {
//postgresql need trx to use cursor based resultset
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
String trxName = m_virtual ? Trx.createTrxName("Loader") : null;
trx = trxName != null ? Trx.get(trxName, true) : null;
// open Statement (closed by Loader.close)

View File

@ -840,9 +840,13 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
isHasNextPage = false;
if (log.isLoggable(Level.FINER))
log.finer(dataSql);
Trx trx = null;
try
{
m_pstmt = DB.prepareStatement(dataSql, null);
//https://jdbc.postgresql.org/documentation/head/query.html#query-with-cursor
String trxName = Trx.createTrxName("InfoPanelLoad:");
trx = Trx.get(trxName, true);
m_pstmt = DB.prepareStatement(dataSql, trxName);
setParameters (m_pstmt, false); // no count
if (log.isLoggable(Level.FINE))
log.fine("Start query - " + (System.currentTimeMillis()-startTime) + "ms");
@ -889,6 +893,7 @@ public abstract class InfoPanel extends Window implements EventListener<Event>,
finally
{
DB.close(m_rs, m_pstmt);
trx.close();
}
if (end > cacheEnd || end <= 0)