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

2018-02-12 Thread Gunnar Morling
Excellent; I've filed https://hibernate.atlassian.net/browse/HHH-12287 for this. I'll try and find some time to provide a PR. What's the cut-off date for 5.3? 2018-02-10 16:17 GMT+01:00 Steve Ebersole : > Yes, I agree. > > On Sat, Feb 10, 2018, 7:55 AM Gunnar Morling wrote: > >> 2018-02-09 16:2

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

2018-02-10 Thread Steve Ebersole
Yes, I agree. On Sat, Feb 10, 2018, 7:55 AM Gunnar Morling wrote: > 2018-02-09 16:26 GMT+01:00 Steve Ebersole : > >> I think constraints should be exported to the DDL when the mode is DDL or >> `hibernate.validator.apply_to_ddl == true`. I'd personally say that ` >> hibernate.validator.apply_to

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

2018-02-10 Thread Gunnar Morling
2018-02-09 16:26 GMT+01:00 Steve Ebersole : > I think constraints should be exported to the DDL when the mode is DDL or > `hibernate.validator.apply_to_ddl == true`. I'd personally say that ` > hibernate.validator.apply_to_ddl` still works with NONE - as y'all keep > saying, mode is about in-memo

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

2018-02-09 Thread Steve Ebersole
I think constraints should be exported to the DDL when the mode is DDL or ` hibernate.validator.apply_to_ddl == true`. I'd personally say that ` hibernate.validator.apply_to_ddl` still works with NONE - as y'all keep saying, mode is about in-memory callbacks. In fact because of that, we should ev

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

2018-02-09 Thread Gunnar Morling
Ok, so the constraints would be added to DDL when "hibernate .validator.apply_to_ddl" is true and validation mode is one of {AUTO, CALLBACK, DDL}. And they wouldn't be added to the DDL if "hibernate .validator.apply_to_ddl" is false or validation mode is NONE? That'd work for me. 2018-02-07 21:07

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

2018-02-07 Thread Steve Ebersole
No, I think you are right and `hibernate.validator.apply_to_ddl` should apply to CALLBACK as well. On Wed, Feb 7, 2018 at 1:45 PM Gunnar Morling wrote: > > How is a String "CALLBACK,DDL" considered "multiple values" to an XSD? > > I was referring to the dedicated element, which is > restricted

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

2018-02-07 Thread Gunnar Morling
> How is a String "CALLBACK,DDL" considered "multiple values" to an XSD? I was referring to the dedicated element, which is restricted to the values AUTO, CALLBACK, NONE in that XSD and which can be given at most once [1]. I can see though how it'd work with the javax.persistence.validation.mode

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

2018-02-07 Thread Steve Ebersole
How is a String "CALLBACK,DDL" considered "multiple values" to an XSD? Look, I don't mind revisiting a change here. I really have no horse n this race - this is not even my code originally. TBH I thought this was code that you did. So I don't mind changes here if there is a consensus. But let'

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

2018-02-07 Thread Gunnar Morling
Right, giving multiple values isn't allowed as per JPA's XSD. 2018-02-07 19:44 GMT+01:00 Steve Ebersole : > Of course you can. `mode = CALLBACK,DDL` > > You mean that you cannot using single-valued setting > > On Wed, Feb 7, 2018 at 12:02 PM Gunnar Morling > wrote: > >> 2018-02-07 16:08 GMT+01:

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

2018-02-07 Thread Steve Ebersole
Of course you can. `mode = CALLBACK,DDL` You mean that you cannot using single-valued setting On Wed, Feb 7, 2018 at 12:02 PM Gunnar Morling wrote: > 2018-02-07 16:08 GMT+01:00 Steve Ebersole : > >> Ok, so this is the crux then because it really comes down to whether you >> believe whether it

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

2018-02-07 Thread Gunnar Morling
2018-02-07 16:08 GMT+01:00 Steve Ebersole : > 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

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

2018-02-07 Thread Steve Ebersole
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 thoug

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

2018-02-06 Thread Guillaume Smet
Hi, On Tue, Feb 6, 2018 at 5:01 PM, Steve Ebersole 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 annota

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

2018-02-06 Thread Steve Ebersole
Well like I said, I understand your not liking that we reuse a JPA-specific setting regarding the validation mode (single-valued) and expand it to accept multiple values. I just think its just as bad to use 2 different settings. 2 wrongs don't make a right. When you say "safest" you mean (I assu

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

2018-02-06 Thread Gunnar Morling
It's not quite clear to me what your preferred alternative is. Not being able to export constraints to DDL when using the safest validation mode (CALLBACK) is not desirable IMHO. +1 to hear what others think. 2018-02-06 17:20 GMT+01:00 Steve Ebersole : > I personally think 2 settings to control

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

2018-02-06 Thread Steve Ebersole
I personally think 2 settings to control 1 thing is fugly, but if there is a consensus that is fine. Bu so far its just been you saying that. On Tue, Feb 6, 2018 at 10:09 AM Gunnar Morling wrote: > > All of those are valid options. But I think Gunnar's suggestion misses > #3, although I certai

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

2018-02-06 Thread Gunnar Morling
> All of those are valid options. But I think Gunnar's suggestion misses #3, although I certainly maybe just missed that in his email. Gunnar? You'd have this: - No validation: validation mode = NONE, hibernate.validator.apply_to_ddl = false - In-memory validation: validation mode = AUTO|CALLBA

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

2018-02-06 Thread Steve Ebersole
On Tue, Feb 6, 2018 at 9:58 AM Gunnar Morling wrote: > My question essentially is why is it alright to piggy-back the enablement > of the DDL constraint export on JPA's validation mode option (which only > has been designed with the lifecycle validation in mind) for AUTO but not > for CALLBACK? >

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

2018-02-06 Thread Steve Ebersole
On Tue, Feb 6, 2018 at 9:43 AM Sanne Grinovero wrote: > On 6 February 2018 at 15:34, Steve Ebersole wrote: > > We tend to do this argument where it "not what we would do". Well not > > everyone is us :) > > Not understanding what you mean with that. I'm well aware others might > have other opin

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

2018-02-06 Thread Gunnar Morling
My question essentially is why is it alright to piggy-back the enablement of the DDL constraint export on JPA's validation mode option (which only has been designed with the lifecycle validation in mind) for AUTO but not for CALLBACK? It causes a few issues: When using CALLBACK (which is the right

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

2018-02-06 Thread Sanne Grinovero
On 6 February 2018 at 15:34, Steve Ebersole wrote: > > > On Tue, Feb 6, 2018 at 9:18 AM Sanne Grinovero wrote: >> >> On 6 February 2018 at 14:46, Steve Ebersole wrote: >> > I'm not sure I would call them separate. They are clearly linked. Look >> > at >> > it this way, if we export various "vali

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

2018-02-06 Thread Steve Ebersole
On Tue, Feb 6, 2018 at 9:18 AM Sanne Grinovero wrote: > On 6 February 2018 at 14:46, Steve Ebersole wrote: > > I'm not sure I would call them separate. They are clearly linked. Look at > > it this way, if we export various "validation" constraints to the > database > > (DDL) it is, practically s

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

2018-02-06 Thread Sanne Grinovero
On 6 February 2018 at 14:46, Steve Ebersole wrote: > I'm not sure I would call them separate. They are clearly linked. Look at > it this way, if we export various "validation" constraints to the database > (DDL) it is, practically speaking, a performance overhead to also perform > those checks in

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

2018-02-06 Thread Steve Ebersole
I'm not sure I would call them separate. They are clearly linked. Look at it this way, if we export various "validation" constraints to the database (DDL) it is, practically speaking, a performance overhead to also perform those checks in memory. Right? This is, I think, the distinction you may be

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

2018-02-06 Thread Gunnar Morling
2018-02-06 14:41 GMT+01:00 Steve Ebersole : > 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. > I think that a) "trigger

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

2018-02-06 Thread Steve Ebersole
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 validat

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

2018-02-06 Thread Chris Cranford
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 cons

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

2018-02-04 Thread Gunnar Morling
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