0
Hello, I am having problems in my project, when I run a Project using Hibernate, after the end of the execution, even closing the connection I can’t change is Project using Ibexpert, it says it is in use. In this case, in order to change the program, I have to do what I need to do and start it again.
The connection is like this.
//preparando Conexão com banco<br/>
Connection conexao = null;<br/>
PreparedStatement comando = null;<br/>
try {<br/>
Context contexto = new InitialContext();<br/>
DataSource dataSource = (DataSource) contexto.lookup("java:/comp/env/jdbc/ConexaoDB");<br/>
conexao = dataSource.getConnection();<br/>
conexao.setAutoCommit(false);<br/>
} catch (SQLException e) {<br/>
if ((conexao!=null) && (! conexao.isClosed())) {<br/>
conexao.close();<br/>
}<br/>
throw new RNException("Falha de conexão com Banco de Dados!");<br/>
} catch (Exception e) {<br/>
if ((conexao!=null) && (! conexao.isClosed())) {<br/>
conexao.close();<br/>
}<br/>
throw new Exception(e);<br/>
}<br/>
Está é a execução da procedure.
//Executando procedure.
StringBuilder stb = new StringBuilder();
stb = new StringBuilder();
stb.append("select RCODIGOPENSIONISTA, RPERCENTUALPENSAO, RPERCENTUALPENSIONISTA, RVALORPENSAO, RBENEFICIOCALCULADO, ");
stb.append("RCOMPLEMENTOSALMINIMO, RIDADE, RFORMAREAJUSTE, RCODCAPACIDADEDEPENDENTE, RCODTIPOGRAUPARENTESCO, ");
stb.append("RQTDEPENSIONISTASATIVOS, RQTDEPENSIONISTASINATIVOS, RDATA_UNIAO_CONJUGAL, RESTUDANTE, RPENSAOVITALICIA, ");
stb.append("RDATA_FIM_BENEFICIO, RMEMORIACALCULO ");
stb.append("from "+nomeProcedureCalPensao+" (?, ?, ?, ?, ?, ?, ?, ?)");
comando = conexao.prepareStatement(stb.toString());
comando.setInt(1, pg_ConcessaoBeneficio.getFi_Vinculo().getCodVinculo());
comando.setBigDecimal(2, pg_ConcessaoBeneficio.getValorBaseCalculo());
comando.setDate(3, Date.valueOf(pg_ConcessaoBeneficio.getDataBaseCalculo()));
comando.setString(4, pg_ConcessaoBeneficio.getTipoConcessao_Pensao().getTipo());
comando.setInt(5, pg_ConcessaoBeneficio.getPg_TipoCausaMorte_InstPens().getCodTipoCausaMorte());
comando.setString(6, pg_ConcessaoBeneficio.getTipoSituacaoInstPensao().getTipo());
comando.setBoolean(7, pg_ConcessaoBeneficio.isInstPensao_PrevidCompl());
comando.setBoolean(8, pg_ConcessaoBeneficio.isAplicarCompSalMinimoPorGrupo());
ResultSet rs = comando.executeQuery();
Após a execução fecho tudo.
rs.close();
comando.close();
conexao.close();
If anyone can help me, I’d appreciate it.