Olá Pessoal!
Não estou conseguinfo excluir uma informação no Banco de Dados, no console do eclipse aparece a seguinte informação:
Erro no commit da transação
Could not execute JDBC batch update
segue abaixo arquivo da pagina onde solicito a exclusão da informação;
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%@ taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@ taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<%@ taglib prefix="htm" uri="http://jsftutorials.net/htmLib"%>
<%@ taglib prefix="tr" uri="http://myfaces.apache.org/trinidad"%>
<%@ taglib prefix="trh" uri="http://myfaces.apache.org/trinidad/html"%>
<%@ taglib prefix="t" uri="http://myfaces.apache.org/tomahawk"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Alterar/Ecluir Dados do Clientes</title>
<link rel="stylesheet" href="css/principal.css" type="text/css" />
</head>
<body>
<f:view>
<htm:div id="mensagens" rendered="#{not empty facesContext.maximumSeverity}">
<h:panelGrid id="painelMensagens" columns="2">
<h:graphicImage value="images/delete-comment-red.gif" title="Erro"></h:graphicImage>
<h:messages></h:messages>
</h:panelGrid>
</htm:div><!-- mensagens -->
<htm:div id="divPrincipal" styleClass="corpoPrincipal">
<h1>S&S Serviços e Estoque Cliente</h1>
<htm:div id="divcorpoDireita" styleClass="corpoDireita">
<htm:div id="previewCliente" styleClass="previewNotaFiscal">
<t:div id="nrNF">
<h:outputText styleClass="inputNrNF" value="Alterar ou Excluir Dados do Cliente!" />
<htm:small style="font-size:10px;"></htm:small>
</t:div><!-- nrNF -->
<h:form id="altexDadosCliente">
<htm:div id="dadosCliente">
<htm:p>Codigo:</htm:p><htm:big><h:outputText value="#{clienteBean.cnf.cliente.codigo}" /></htm:big>
<htm:p>Nome/Razão Social:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.nome}" /></htm:big>
<htm:p>Endereço:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.endereco}" /></htm:big>
<htm:p>Complemento:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.complemento}" /></htm:big>
<htm:p>Bairro:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.bairro}" /></htm:big>
<htm:p>Cidade:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.cidade}" /></htm:big>
<htm:p>Uf:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.uf}" /></htm:big>
<htm:p>Cep:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.cep}" /></htm:big>
<htm:p>Data de Nascimento:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.datanasc}" /></htm:big>
<htm:p>Cliente Desde:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.desde}" /></htm:big>
<htm:p>Rg:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.rg}" /></htm:big>
<htm:p>CPF:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.cpf}" /></htm:big>
<htm:p>CNPJ:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.cnpj}" /></htm:big>
<htm:p>Inscrição Estadual:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.insest}" /></htm:big>
<htm:p>Fone Residencial:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.foneres}" /></htm:big>
<htm:p>Fone Comercial:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.fonecom}" /></htm:big>
<htm:p>Fax:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.fax}" /></htm:big>
<htm:p>Celular:</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.celular}" /></htm:big>
<htm:p>Contato</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.contato}" /></htm:big>
<htm:p>Observações</htm:p><htm:big><h:inputText value="#{clienteBean.cnf.cliente.observacao}" /></htm:big>
</htm:div><!-- dadosCliente -->
<h:commandButton id="alterarCliente" value="Alterar" action="#{clienteBean.cnf.alteraCliente}" styleClass="panelBotaoEditar"
onclick="return confirm('Deseja Alterar os Dados do Cliente?');">
</h:commandButton>
<h:commandButton id="excluirCliente" value="Excluir" action="#{clienteBean.cnf.excluiCliente}" styleClass="panelBotaoSubtrair"
onclick="return confirm('Deseja Realmente Excluir este Cliente?');">
</h:commandButton>
</h:form><!-- altexDadosClientes -->
</htm:div><!-- previewCliente -->
</htm:div><!-- divcorpoDireita -->
</htm:div><!-- divPrincipal -->
</f:view>
</body>
</html>
arquivo do faces-config.xml:
<navigation-rule>
<from-view-id>/clientealteraexclui.jsp</from-view-id>
<navigation-case>
<from-outcome>altClisucesso</from-outcome>
<to-view-id>clientealterado.jsp</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>exClisucesso</from-outcome>
<to-view-id>clienteexcluido.jsp</to-view-id>
</navigation-case>
</navigation-rule>
arquivo onde coloquei o metodo para excluir:
package br.com.ses.modelo.bean;
import java.util.Date;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
import br.com.ses.modelo.dao.HibernateDAO;
import br.com.ses.modelo.dao.InterfaceDAO;
import br.com.ses.util.FacesContextUtil;
@Entity(name="cnf_e")
public class CNF {
private Long numero;
private CFOp codFiscalOp;
private Cliente cliente;
private Date emissao;
private Date entrada;
private Double total;
private String observacao;
private Set<DNF> detalheNF;
@Id
public Long getNumero() {
return numero;
}
public void setNumero(Long numero) {
this.numero = numero;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="cfop_codigo")
public CFOp getCodFiscalOp() {
return codFiscalOp;
}
public void setCodFiscalOp(CFOp codFiscalOp) {
this.codFiscalOp = codFiscalOp;
}
@ManyToOne(fetch=FetchType.LAZY)
@JoinColumn(name="fornecedor_codigo")
public Cliente getCliente() {
return cliente;
}
public void setCliente(Cliente cliente) {
this.cliente = cliente;
}
public Date getEmissao() {
return emissao;
}
public void setEmissao(Date emissao) {
this.emissao = emissao;
}
public Date getEntrada() {
return entrada;
}
public void setEntrada(Date entrada) {
this.entrada = entrada;
}
public Double getTotal() {
return total;
}
public void setTotal(Double total) {
this.total = total;
}
public String getObservacao() {
return observacao;
}
public void setObservacao(String observacao) {
this.observacao = observacao;
}
@OneToMany(fetch=FetchType.LAZY, mappedBy="cnf")
@Cascade(value={CascadeType.SAVE_UPDATE})
@JoinColumn(name="cnfe_numero", insertable=true, updatable=true)
public Set<DNF> getDetalheNF() {
return detalheNF;
}
public void setDetalheNF(Set<DNF> detalheNF) {
this.detalheNF = detalheNF;
}
public String alteraCliente(){
InterfaceDAO<Cliente> clienteDAO = new HibernateDAO<Cliente>(Cliente.class, FacesContextUtil.getRequestSession());
clienteDAO.atualizar(cliente);
return "altClisucesso";
}
public String excluiCliente(){
InterfaceDAO<Cliente> clienteDAO = new HibernateDAO<Cliente>(Cliente.class, FacesContextUtil.getRequestSession());
clienteDAO.excluir(cliente);
return "exClisucesso";
}
}
gostaria muito de ajuda para solucionar este problema!
Jairo Dione