0
I have a method that deletes a company entity and its attachments, after the archiving of a protocol, however, when I try to delete, this happens:
Caused by: java.sql.BatchUpdateException: Entrada em lote 0 delete from pessoa where codigo='34635PI' foi abortada. Chame getNextException para ver a causa.
Method to delete the company and its attached files
public static void excluirEmpresaAposArquivamentoProtocolo(ArquivoRegistroOnlineEmpresaDao arquivoRegistroOnlineEmpresaDao, EmpresaDao empresaDao, String codigoEmpresa) {
Empresa empresa = empresaDao.pesquisarPorId(codigoEmpresa);
Map<String, Object> params = new HashMap<String, Object>();
String queryArquivosRegistro = "SELECT aroe FROM ArquivoRegistroOnlineEmpresa aroe "
+ "WHERE aroe.empresa = :empresa";
params.put("empresa", empresa);
List<ArquivoRegistroOnlineEmpresa> arquivosRegistroOnlineEmpresa = arquivoRegistroOnlineEmpresaDao.listPesqParam(queryArquivosRegistro, params);
for(ArquivoRegistroOnlineEmpresa aroe : arquivosRegistroOnlineEmpresa) {
File f = new File(aroe.getCaminhoArquivo());
f.delete();
arquivoRegistroOnlineEmpresaDao.excluir(aroe);
}
empresaDao.excluir(empresa);
}
Stacktrace
Userj, please edit post the error stacktrace.
– Filipe L. Constante
I put in the Pastebin, the link is in the question
– userJ
I can’t access this link, so there’s no way to help it.
– Filipe L. Constante
Read on: https://answall.com/help/how-to-ask
– Filipe L. Constante
I chose to put in Pastebin, because of character limitation
– userJ