alguem sabe como pegar e tratar a exception gerada pelo hibernate no jsf?
Hibernate: delete from infor.public.cd_grupopreco where id_grupopreco=?
Out 30, 2013 9:38:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: 23503
Out 30, 2013 9:38:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: Entrada em lote 0 delete from infor.public.cd_grupopreco where id_grupopreco=12111 foi abortada. Chame getNextException para ver a causa.
Out 30, 2013 9:38:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
WARNING: SQL Error: 0, SQLState: 23503
Out 30, 2013 9:38:53 AM org.hibernate.util.JDBCExceptionReporter logExceptions
SEVERE: ERROR: update or delete on table "cd_grupopreco" violates foreign key constraint "fk_grupopreco_produto" on table "cd_produto"
Detalhe: Key (id_grupopreco)=(12111) is still referenced from table "cd_produto".
Out 30, 2013 9:38:53 AM org.hibernate.event.def.AbstractFlushingEventListener performExecutions
SEVERE: Could not synchronize database state with session
org.hibernate.exception.ConstraintViolationException: Could not execute JDBC batch update
eu tento assim
[code]public void excluir(CdGrupoprecoVO preco){
try {
this.dao.excluir(preco);
FacesMessage fm = new FacesMessage(preco.getDescricaoGrpprc()+" excluido!");
FacesContext.getCurrentInstance().addMessage(null, fm);
} catch (ConstraintViolationException e) {
FacesMessage fm = new FacesMessage("Erro na operacao" + e);
FacesContext.getCurrentInstance().addMessage(null, fm);
}
}[/code]
mas nao aparece no p:growl