diff --git a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java index 2569143f2..217ee44da 100644 --- a/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java +++ b/src/com/rjconsultores/ventaboletos/dao/hibernate/EmpresaHibernateDAO.java @@ -191,13 +191,21 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO i Connection conn = null; try { 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()) { - 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) { 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) { throw new RuntimeException(e); }finally {