[hibernate-dev] ORM DDL doesn't reflect BV constraints with validation mode CALLBACK

Gunnar Morling gunnar at hibernate.org
Wed Feb 7 13:02:36 EST 2018

2018-02-07 16:08 GMT+01:00 Steve Ebersole <steve at hibernate.org>:

> Ok, so this is the crux then because it really comes down to whether you
> believe whether it is valid to *only* export the annotation-based
> validations as DDL.
> And keep in mind that this code is basically unchanged from all the way
> back to the initial "integrations" with HV.  So back then the
> thought-process (not mine, btw) was that yes, that *is* valid - hence the
> option to chose just DDL as an option.

You'd still have that ability with my suggestion, just keep validation mode
to NONE and set hibernate.validator.apply_to_ddl = true.

By "safest mode" above I meant CALLBACK is the right way if you really want
to make sure that lifecycle validation occurs, or you'll get an exception
if no BV provider is present. It can't happen that lifecycle validation
silently, unexpectedly doesn't happen. Hence I prefer it over AUTO. And as
things stand I can't benefit from constraints in DDL export in that case,
which is a pity.

But if thats now no longer valid then that changes things.
> On Tue, Feb 6, 2018 at 3:15 PM Guillaume Smet <guillaume.smet at gmail.com>
> wrote:
> > Hi,
> >
> > On Tue, Feb 6, 2018 at 5:01 PM, Steve Ebersole <steve at hibernate.org>
> > wrote:
> >>
> >> Is it valid for a user to want *just* DDL-based validation?  How would
> >> that
> >> work in Gunnar's request?
> >>
> >
> > From your writings, I suspect I'm the only one with this opinion but my
> > answer would be: "not if you use Bean Validation annotations".
> >
> > If you use BV's @NotNull, you expect BV to validate the input. And you
> > might want additional DDL in your database to be on the safe side (which
> > should be the default IMHO).
> >
> > --
> > Guillaume
> >
> _______________________________________________
> hibernate-dev mailing list
> hibernate-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/hibernate-dev

More information about the hibernate-dev mailing list