Pessoal, estou com um problema nos meus exceptions.
Quando faço uma inserção violando a UniqueKey, ele dá o seguinte erro:
Hibernate operation: could not insert: [org.tcc.model.Categoria]; uncategorized SQLException for SQL [insert into CATEGORIA (VERSION, DESCRICAO, IDCATEGORIA) values (?, ?, ?)]; SQL state [HY000]; error code [335544665]; GDS Exception. 335544665. violation of PRIMARY or UNIQUE KEY constraint "INTEG_209" on table "CATEGORIA"; nested exception is org.firebirdsql.jdbc.FBSQLException: GDS Exception. 335544665. violation of PRIMARY or UNIQUE KEY constraint "INTEG_209" on table "CATEGORIA"
O meu exception está assim:
public void salvarCategoria(Categoria categoria) throws CategoriaExistsException {
try {
categoriaDao.salvarCategoria(categoria);
}
catch (DataIntegrityViolationException e){
throw new CategoriaExistsException("errors.existing.categoria");
}
}
O que devo fazer nesse método para ele tratar aquele erro?
Obrigado