Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce JPA bootstrap failure for incomplete Hibernate Validator setup #30549

Closed
jhoeller opened this issue May 25, 2023 · 0 comments
Closed
Assignees
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Milestone

Comments

@jhoeller
Copy link
Contributor

Following up on spring-projects/spring-boot#35617 (comment), it seems suboptimal for Hibernate ORM to silently skip validation in case of an incomplete Hibernate Validator setup without a Jakarta EL provider on the classpath. It is too easy to add Hibernate Validator but miss the EL provider, none of which is noticeable through JPA setup.

We could provide custom detection of validation engine presence in DefaultPersistenceUnitManager and set the validation mode to "CALLBACK" in that case, enforcing bootstrap failure for an incomplete setup.

@jhoeller jhoeller added in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement labels May 25, 2023
@jhoeller jhoeller added this to the 6.1.0-M1 milestone May 25, 2023
@jhoeller jhoeller self-assigned this May 25, 2023
bclozel added a commit that referenced this issue Dec 6, 2023
In gh-30549 we applied changes to the `DefaultPersistenceUnitManager` to
use the `ValidationMode.CALLBACK` to better detect invalid validation
setup and enforce bootstrap failures in those cases.

Unfortunately, doing so disables the detection of validation annotation
on entities during the schema creation phase. This is a known Hibernate
issue. This commit reverts this change until HHH-12287 is fixed.

Fixes gh-31726
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: data Issues in data modules (jdbc, orm, oxm, tx) type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

1 participant