JOOQ: DataAccessException and Limitations

I am implementing a REST API with Jersey and jOOQ.

I have a table with some restrictions, for example, a unique key. When you insert a tuple that violates this restriction, jOOQ throws DataAccessException:

org.jooq.exception.DataAccessException: SQL [insert into ...]; ERROR: duplicate key value violates unique constraint "issue_name_key"

Is there a way to find out which restriction was violated without string parsing the error message? If the restriction is violated, I want to return the 400 bad requesthttp status code instead 500 general error.

If this is not possible, then what is the common practice here? Should I query the database for every possible violation of restrictions? It smells like a service trap.

+4
source share
1

: jOOQ, JDBC.

+3

All Articles