* Minor trx fix, reported here

- https://sourceforge.net/forum/message.php?msg_id=4349419
This commit is contained in:
Heng Sin Low 2007-06-07 02:07:30 +00:00
parent a904062c17
commit 366ff46f9d
1 changed files with 17 additions and 5 deletions

View File

@ -631,14 +631,26 @@ public class MSequence extends X_AD_Sequence
return seq.save(); return seq.save();
} // createTableSequence } // createTableSequence
/**
* Get Sequence
* @param ctx context
* @param tableName table name
* @return Sequence
*/
public static MSequence get (Properties ctx, String tableName)
{
return get(ctx, tableName, null);
}
/** /**
* Get Sequence * Get Sequence
* @param ctx context * @param ctx context
* @param tableName table name * @param tableName table name
* @param trxName optional transaction name
* @return Sequence * @return Sequence
*/ */
public static MSequence get (Properties ctx, String tableName) public static MSequence get (Properties ctx, String tableName, String trxName)
{ {
String sql = "SELECT * FROM AD_Sequence " String sql = "SELECT * FROM AD_Sequence "
+ "WHERE UPPER(Name)=?" + "WHERE UPPER(Name)=?"
@ -647,11 +659,11 @@ public class MSequence extends X_AD_Sequence
PreparedStatement pstmt = null; PreparedStatement pstmt = null;
try try
{ {
pstmt = DB.prepareStatement (sql, null); pstmt = DB.prepareStatement (sql, trxName);
pstmt.setString (1, tableName.toUpperCase()); pstmt.setString (1, tableName.toUpperCase());
ResultSet rs = pstmt.executeQuery (); ResultSet rs = pstmt.executeQuery ();
if (rs.next ()) if (rs.next ())
retValue = new MSequence (ctx, rs, null); retValue = new MSequence (ctx, rs, trxName);
if (rs.next()) if (rs.next())
s_log.log(Level.SEVERE, "More then one sequence for " + tableName); s_log.log(Level.SEVERE, "More then one sequence for " + tableName);
rs.close (); rs.close ();