Describe the bug
Having a JPA entity with a natural ID, when performing an HTTP POST that violates the primary key, a 500 error is returned along with the internal stacktrace.
Expected behavior
The REST resource should handle violated primary key constraint errors and return a different HTTP code (409 - Conflict may be a good choice)
Actual behavior
The following output is displayed:
Describe the bug Having a JPA entity with a natural ID, when performing an HTTP POST that violates the primary key, a 500 error is returned along with the internal stacktrace.
Expected behavior The REST resource should handle violated primary key constraint errors and return a different HTTP code (409 - Conflict may be a good choice)
Actual behavior The following output is displayed:
To Reproduce
Reproducer project here:
category-crud.zip
Once the application is running, open a Terminal and run the following command twice:
And you should see the error above.
Environment (please complete the following information):
uname -a
orver
: Fedora 33java -version
: JDK 11mvnw --version
orgradlew --version
): Mavenhttps://github.com/quarkusio/quarkus/issues/14281
$upstream:14281$