IDEMPIERE-1195 Native Sequences is reseting start on DB failures

This commit is contained in:
Carlos Ruiz 2013-07-23 18:13:20 -05:00
parent e370759d4b
commit 121ac12f86
4 changed files with 5 additions and 4 deletions

View File

@ -1501,6 +1501,7 @@ public class GridTable extends AbstractTableModel
{ {
log.log(Level.SEVERE, "Persistency Issue - " log.log(Level.SEVERE, "Persistency Issue - "
+ m_tableName + ": " + e.getLocalizedMessage(), e); + m_tableName + ": " + e.getLocalizedMessage(), e);
log.saveError("Error", e.getLocalizedMessage());
return SAVE_ERROR; return SAVE_ERROR;
} }
} }

View File

@ -702,7 +702,7 @@ public class MSequence extends X_AD_Sequence
if (tableID && SYSTEM_NATIVE_SEQUENCE) if (tableID && SYSTEM_NATIVE_SEQUENCE)
{ {
int next_id = DB.getSQLValue(trxName, "SELECT CurrentNext FROM AD_Sequence WHERE Name=? AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y'", TableName); int next_id = DB.getSQLValueEx(trxName, "SELECT CurrentNext FROM AD_Sequence WHERE Name=? AND IsActive='Y' AND IsTableID='Y' AND IsAutoSequence='Y'", TableName);
if (next_id == -1) if (next_id == -1)
{ {
MSequence seq = new MSequence (ctx, 0, trxName); MSequence seq = new MSequence (ctx, 0, trxName);
@ -793,7 +793,7 @@ public class MSequence extends X_AD_Sequence
} }
catch (Exception e) catch (Exception e)
{ {
s_log.log(Level.SEVERE, "get", e); throw new DBException(e);
} }
finally finally
{ {

View File

@ -1239,7 +1239,7 @@ public class DB_Oracle implements AdempiereDatabase
} }
public int getNextID(String Name) { public int getNextID(String Name) {
int m_sequence_id = DB.getSQLValue(null, "SELECT "+Name.toUpperCase()+".nextval FROM DUAL"); int m_sequence_id = DB.getSQLValueEx(null, "SELECT "+Name.toUpperCase()+".nextval FROM DUAL");
return m_sequence_id; return m_sequence_id;
} }

View File

@ -948,7 +948,7 @@ public class DB_PostgreSQL implements AdempiereDatabase
public int getNextID(String name) { public int getNextID(String name) {
int m_sequence_id = DB.getSQLValue(null, "SELECT nextval('"+name.toLowerCase()+"')"); int m_sequence_id = DB.getSQLValueEx(null, "SELECT nextval('"+name.toLowerCase()+"')");
return m_sequence_id; return m_sequence_id;
} }