fixed bug #8070 - fechando conexões abertas, nova empresa e geração títulos punto venta
git-svn-id: http://desenvolvimento.rjconsultores.com.br/repositorio/sco/AdmVenta/Model/trunk/modelWeb@61270 d1611594-4594-4d17-8e1d-87c2c4800839master
parent
2f832f7052
commit
6f0ad627a0
|
@ -175,8 +175,9 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO<Empresa, Integer> i
|
||||||
}
|
}
|
||||||
|
|
||||||
private void gerarSeqNumFolioSistema(Integer idEmpresa) throws RuntimeException {
|
private void gerarSeqNumFolioSistema(Integer idEmpresa) throws RuntimeException {
|
||||||
|
Connection conn = null;
|
||||||
try {
|
try {
|
||||||
Connection conn = dataSource.getConnection();
|
conn = dataSource.getConnection();
|
||||||
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" };
|
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" };
|
||||||
|
|
||||||
|
@ -186,6 +187,14 @@ public class EmpresaHibernateDAO extends GenericHibernateDAO<Empresa, Integer> i
|
||||||
}
|
}
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
}finally {
|
||||||
|
try {
|
||||||
|
if(conn != null && !conn.isClosed()){
|
||||||
|
conn.close();
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue