In my application, when the violation key is raised, I would like to get the name of the restriction, but I find no way to get this information. The message returned by "getMessage ()" is very summarized, and I need to get additional error information in order to make a custom error message to the end user.
Stack trace:
84732 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23505 84732 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "ix_tb_oferta_vaga" Detalhe: Key (cd_pj, cd_curso)=(680, 29) already exists. 187405 [http-8080-1] WARN org.hibernate.util.JDBCExceptionReporter - SQL Error: 0, SQLState: 23505 187405 [http-8080-1] ERROR org.hibernate.util.JDBCExceptionReporter - ERROR: duplicate key value violates unique constraint "ix_tb_oferta_vaga" Detalhe: Key (cd_pj, cd_curso)=(680, 29) already exists.
GetMessage () function:
could not insert: [br.gov.ce.seduc.estagio.model.bean.OfertaVaga]; nested exception is org.hibernate.exception.ConstraintViolationException: could not insert: [br.gov.ce.seduc.estagio.model.bean.OfertaVaga]
Thanks.
Arthur
source share