Heng Sin Low 2009-05-20 05:24:13 +00:00
parent c0eb0c637e
commit 82e632660e
1 changed files with 13 additions and 3 deletions

View File

@ -64,6 +64,8 @@ public class MSequence extends X_AD_Sequence
/** Log Level for Next ID Call */ /** Log Level for Next ID Call */
private static final Level LOGLEVEL = Level.ALL; private static final Level LOGLEVEL = Level.ALL;
private static final int QUERY_TIME_OUT = 10;
public static int getNextID (int AD_Client_ID, String TableName) public static int getNextID (int AD_Client_ID, String TableName)
{ {
return getNextID(AD_Client_ID, TableName, null); return getNextID(AD_Client_ID, TableName, null);
@ -129,7 +131,9 @@ public class MSequence extends X_AD_Sequence
pstmt = conn.prepareStatement(selectSQL, pstmt = conn.prepareStatement(selectSQL,
ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE); ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
pstmt.setString(1, TableName); pstmt.setString(1, TableName);
// //
if (!USE_PROCEDURE)
pstmt.setQueryTimeout(QUERY_TIME_OUT);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
if (CLogMgt.isLevelFinest()) if (CLogMgt.isLevelFinest())
s_log.finest("AC=" + conn.getAutoCommit() + ", RO=" + conn.isReadOnly() s_log.finest("AC=" + conn.getAutoCommit() + ", RO=" + conn.isReadOnly()
@ -285,6 +289,7 @@ public class MSequence extends X_AD_Sequence
cstmt.setInt(1, AD_Sequence_ID); cstmt.setInt(1, AD_Sequence_ID);
cstmt.setString(2, adempiereSys ? "Y" : "N"); cstmt.setString(2, adempiereSys ? "Y" : "N");
cstmt.registerOutParameter(3, Types.INTEGER); cstmt.registerOutParameter(3, Types.INTEGER);
cstmt.setQueryTimeout(QUERY_TIME_OUT);
cstmt.execute(); cstmt.execute();
retValue = cstmt.getInt(3); retValue = cstmt.getInt(3);
} }
@ -323,6 +328,7 @@ public class MSequence extends X_AD_Sequence
cstmt.setInt(2, incrementNo); cstmt.setInt(2, incrementNo);
cstmt.setString(3, calendarYear); cstmt.setString(3, calendarYear);
cstmt.registerOutParameter(4, Types.INTEGER); cstmt.registerOutParameter(4, Types.INTEGER);
cstmt.setQueryTimeout(QUERY_TIME_OUT);
cstmt.execute(); cstmt.execute();
retValue = cstmt.getInt(4); retValue = cstmt.getInt(4);
} catch (Exception e) { } catch (Exception e) {
@ -486,7 +492,9 @@ public class MSequence extends X_AD_Sequence
if (isStartNewYear) if (isStartNewYear)
pstmt.setString(3, calendarYear); pstmt.setString(3, calendarYear);
// //
if (!USE_PROCEDURE)
pstmt.setQueryTimeout(QUERY_TIME_OUT);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
// s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation() // s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation()
// + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency()); // + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency());
@ -765,7 +773,9 @@ public class MSequence extends X_AD_Sequence
if (isStartNewYear) if (isStartNewYear)
pstmt.setString(2, calendarYear); pstmt.setString(2, calendarYear);
// //
if (!USE_PROCEDURE)
pstmt.setQueryTimeout(QUERY_TIME_OUT);
rs = pstmt.executeQuery(); rs = pstmt.executeQuery();
// s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation() // s_log.fine("AC=" + conn.getAutoCommit() + " -Iso=" + conn.getTransactionIsolation()
// + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency()); // + " - Type=" + pstmt.getResultSetType() + " - Concur=" + pstmt.getResultSetConcurrency());