bug#10906

dev:lucas
qua:wallysson

git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@81126 d1611594-4594-4d17-8e1d-87c2c4800839
master
wilian 2018-04-18 20:36:01 +00:00
parent af82470a28
commit 86c8e016ef
1 changed files with 10 additions and 2 deletions

View File

@ -191,13 +191,21 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO<Empresa, Integer> i
Connection conn = null; Connection conn = null;
try { try {
conn = dataSource.getConnection(); conn = dataSource.getConnection();
String[] sequences = { "AC", "AL", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MG", "MS", "MT", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RR", "RS", "SC", "SE", "SP", "TO" };
if (!conn.createStatement().executeQuery("select SEQUENCE_NAME from DBA_SEQUENCES where SEQUENCE_NAME like 'FOLIO_SISTEMA_" + idEmpresa + "_SEQ%'").next()) { if (!conn.createStatement().executeQuery("select SEQUENCE_NAME from DBA_SEQUENCES where SEQUENCE_NAME like 'FOLIO_SISTEMA_" + idEmpresa + "_SEQ%'").next()) {
String[] sequences = { "AC", "AL", "AM", "AP", "BA", "CE", "DF", "ES", "GO", "MA", "MG", "MS", "MT", "PA", "PB", "PE", "PI", "PR", "RJ", "RN", "RO", "RR", "RS", "SC", "SE", "SP", "TO" };
for (String sequence : sequences) { for (String sequence : sequences) {
conn.createStatement().execute("CREATE SEQUENCE FOLIO_SISTEMA_" + (sequence == "" ? sequence : (sequence + "_") + idEmpresa + "_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE")); conn.createStatement().execute("CREATE SEQUENCE FOLIO_SISTEMA_" + (sequence == "" ? sequence : (sequence + "_") + idEmpresa + "_SEQ INCREMENT BY 1 START WITH 1 NOCACHE ORDER NOCYCLE"));
} }
} }
/*
* Cria as sequences de numeração dos bilhetes do BPe
*/
if (!conn.createStatement().executeQuery("select SEQUENCE_NAME from DBA_SEQUENCES where SEQUENCE_NAME like 'FOLIO_SISTEMA_BPE_" + idEmpresa + "_SEQ%'").next()) {
for (String sequence : sequences) {
conn.createStatement().execute("CREATE SEQUENCE FOLIO_SISTEMA_BPE_" + (sequence == "" ? sequence : (sequence + "_") + idEmpresa + "_SEQ MINVALUE 1 MAXVALUE 999999999 INCREMENT BY 1 START WITH 1 ORDER NOCACHE CYCLE"));
}
}
} catch (SQLException e) { } catch (SQLException e) {
throw new RuntimeException(e); throw new RuntimeException(e);
}finally { }finally {