IDEMPIERE-422 Complete Native Sequence feature / create the sequence if it doesn't exist on first usage, useful for native sequences not created on migration scripts
This commit is contained in:
parent
83a7f121c3
commit
d735ce2e22
|
@ -1867,6 +1867,11 @@ public final class DB
|
||||||
if(SYSTEM_NATIVE_SEQUENCE && !adempiereSys)
|
if(SYSTEM_NATIVE_SEQUENCE && !adempiereSys)
|
||||||
{
|
{
|
||||||
int m_sequence_id = CConnection.get().getDatabase().getNextID(TableName+"_SQ");
|
int m_sequence_id = CConnection.get().getDatabase().getNextID(TableName+"_SQ");
|
||||||
|
if (m_sequence_id == -1) {
|
||||||
|
// try to create the sequence and try again
|
||||||
|
MSequence.createTableSequence(Env.getCtx(), TableName, trxName, true);
|
||||||
|
m_sequence_id = CConnection.get().getDatabase().getNextID(TableName+"_SQ");
|
||||||
|
}
|
||||||
return m_sequence_id;
|
return m_sequence_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue