Question

I would like to perform @Range based hibernate validation checks (org.hibernate.validator.RangeValidator) in my JPA entity code. But it seems to modify the generated SQL with this checks which I would like to avoid. (i.e In the range check, I have the current year as the @Range max value which is bound to change every year).

Hence, I had to remove this annotation from my JPA entity class. How would I be able to perform similar checks without adding the annotation? Should I do these checks in prePersist or preUpdate if so, how do I invoke the validators.

Appreciate any inputs on this topic

Was it helpful?

Solution

Section 2.1 on the reference guide talks about how to disable ddl generation using the following flag, set hibernate.validator.apply_to_ddl to false. I am using this flag to avoid ddl modification. Hence, I am closing this issue

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top