Removing some unnecesary code after [ 1886013 ] MSequence.getNextId should be executed outside of trx
This commit is contained in:
parent
14deebdab7
commit
9c85560ff3
|
@ -142,22 +142,15 @@ public class MSequence extends X_AD_Sequence
|
||||||
Connection conn = null;
|
Connection conn = null;
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
boolean autocommit = false;
|
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (trx != null)
|
|
||||||
//conn = trx.getConnection();
|
|
||||||
//else
|
|
||||||
conn = DB.getConnectionID();
|
conn = DB.getConnectionID();
|
||||||
// Error
|
// Error
|
||||||
if (conn == null)
|
if (conn == null)
|
||||||
return -1;
|
return -1;
|
||||||
//
|
|
||||||
//jz auto commit off here
|
|
||||||
autocommit = conn.getAutoCommit();
|
|
||||||
conn.setAutoCommit(false);
|
|
||||||
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);
|
||||||
|
@ -270,14 +263,9 @@ public class MSequence extends X_AD_Sequence
|
||||||
s_log.log(Level.SEVERE, TableName + " - " + e.getMessage(), e);
|
s_log.log(Level.SEVERE, TableName + " - " + e.getMessage(), e);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
conn.rollback();
|
if (conn != null)
|
||||||
conn.setAutoCommit(autocommit); //jz set back
|
conn.rollback();
|
||||||
if (pstmt != null)
|
} catch (SQLException e1) { }
|
||||||
pstmt.close();
|
|
||||||
}
|
|
||||||
catch (SQLException e1)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -286,9 +274,6 @@ public class MSequence extends X_AD_Sequence
|
||||||
rs = null;
|
rs = null;
|
||||||
if (conn != null)
|
if (conn != null)
|
||||||
{
|
{
|
||||||
try {
|
|
||||||
conn.setAutoCommit(autocommit); //jz set back
|
|
||||||
} catch (SQLException e) {}
|
|
||||||
try {
|
try {
|
||||||
conn.close();
|
conn.close();
|
||||||
} catch (SQLException e) {}
|
} catch (SQLException e) {}
|
||||||
|
@ -616,9 +601,10 @@ public class MSequence extends X_AD_Sequence
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (trx == null && conn != null)
|
if (trx == null && conn != null) {
|
||||||
conn.close();
|
conn.close();
|
||||||
conn = null;
|
conn = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
@ -984,9 +970,10 @@ public class MSequence extends X_AD_Sequence
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
if (trx == null && conn != null)
|
if (trx == null && conn != null) {
|
||||||
conn.close();
|
conn.close();
|
||||||
conn = null;
|
conn = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue