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

Steve Ebersole steve at hibernate.org
Tue Feb 6 08:41:22 EST 2018


The reasoning is that the 2 BV modes you mention make no mention of also
applying constraints to the database.  It would be surprising for that to
happen.  I can see the argument for AUTO, but absolutely not for CALLBACK.

Also important is the distinction that hibernate accepts multivalued
validation modes, whereas BV does not if I remember correctly... Although
in my opinion it absolutely should.

On Tue, Feb 6, 2018, 7:35 AM Chris Cranford <chris at hibernate.org> wrote:

> Gunnar -
>
> I don't particularly see a reason why we cannot as it seems we're
> handling the CALLBACK mode with no BV provider present earlier in the
> code path.  I'm fine changing it.
>
> Chris
>
>
> On 02/04/2018 07:21 AM, Gunnar Morling wrote:
> > Hi,
> >
> > If the JPA validation mode is set to CALLBACK, BV constraints such as
> > @NotNull, @Size etc. are not reflected in the DDL created by ORM.
> >
> > Instead, in TypeSafeActivator, the BV constraints are only considered for
> > DDL if the validation mode is DDL or AUTO [1].
> >
> > CALLBACK is the safe way to ensure BV is invoked by JPA (instead of
> > silently ignoring it if no BV provider is present), so it's the setting I
> > usually recommend. I think constraints should also be propagated to DDL
> in
> > this mode, so I'm wondering whether there a specific reason for the
> current
> > behaviour or wether we can change it?
> >
> > Thanks,
> >
> > --Gunnar
> >
> > [1]
> >
> https://github.com/hibernate/hibernate-orm/blob/master/hibernate-core/src/main/java/org/hibernate/cfg/beanvalidation/TypeSafeActivator.java#L146
> > _______________________________________________
> > hibernate-dev mailing list
> > hibernate-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/hibernate-dev
>
> _______________________________________________
> 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