SimpleJDBCCall Spring 不执行 [英] SimpleJDBCCall Spring not execute
本文介绍了SimpleJDBCCall Spring 不执行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有这个方法
public void importarAdiantamento(ArrayList<LayoutArquivo> arquivos, Usuario usuario) throws Exception {
try {
for(LayoutArquivo arquivo : arquivos) {
DateFormat fmt = new SimpleDateFormat("dd/MM/yyyy");
SqlParameterSource in = new MapSqlParameterSource()
.addValue("DATAVCM", new java.sql.Date(fmt.parse(arquivo.getVencimento()).getTime()))
.addValue("VALOR", arquivo.getValor())
.addValue("MOTIVO", arquivo.getCodMotivo())
.addValue("EMPRESA", arquivo.getCodEmpresa())
.addValue("NPARCELA", 1)
.addValue("TOTALPARCELA", 1)
.addValue("DOCUMENTO", arquivo.getDocumento())
.addValue("FUNCIONARIO", arquivo.getCodFunc())
.addValue("HISTORICO", "VALE IMPORTADO")
.addValue("EXPORTAR", 0)
.addValue("USUARIO", usuario.getCodigousuario())
.addValue("DUPLIC", 0)
.addValue("PROTOCOLO", "0");
SimpleJdbcCall jdbcCall = new SimpleJdbcCall(jdbcTemplate)
.withProcedureName(AdiantamentoQueries.importarAdiantamento())
.declareParameters(
new SqlParameter("DATAVCM", Types.DATE),
new SqlParameter("VALOR", Types.NUMERIC),
new SqlParameter("MOTIVO", Types.NUMERIC),
new SqlParameter("EMPRESA", Types.NUMERIC),
new SqlParameter("NPARCELA", Types.NUMERIC),
new SqlParameter("TOTALPARCELA", Types.NUMERIC),
new SqlParameter("DOCUMENTO", Types.VARCHAR),
new SqlParameter("FUNCIONARIO", Types.NUMERIC),
new SqlParameter("HISTORICO", Types.VARCHAR),
new SqlParameter("EXPORTAR", Types.NUMERIC),
new SqlParameter("USUARIO", Types.NUMERIC),
new SqlOutParameter("DUPLIC", Types.NUMERIC),
new SqlParameter("PROTOCOLO", Types.VARCHAR)
);
System.out.println("executando o documento " + arquivo.getDocumento());
jdbcCall.execute(in);
System.out.println("terminou de executar o documento" + arquivo.getDocumento());
}
}catch (Exception e) {
throw new Exception(e);
}
}
何时到达jdbcCall.execute(in);
执行挂起就像你在等待而不是继续.不知道发生了什么
When arrive in line jdbcCall.execute(in);
The execution hangs like you're waiting and not continue.
No have idea what going on
我在控制台打印信息,只有这个被打印
I printed information in console and only this is printed
executando o documento 72527
由于我只能在所有 for
记录成功完成后才能提交,所以我已经放置了 @Transactional
注释但它也不起作用
Since I can only commit when all of the for
records have been successfully completed, I had placed the @Transactional
annotation but it did not work either
运行后这个方法是java,这是我数据库中的一个会话:
after run this method is java, this is a sessions in my database:
推荐答案
- 您是否在数据库中看到您的事务正在运行?
- 您是直接在数据库中执行该过程而不是在 Java 中运行吗?
- 不存在任何并行运行的进程导致数据库锁定?
希望能帮到你.
这篇关于SimpleJDBCCall Spring 不执行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文