[bv-dev] BVAL-234 @NotNull @Id for JPA and Bean Validation

Hardy Ferentschik hardy at hibernate.org
Tue May 22 04:54:01 EDT 2012


I agree with Gunnar. I still find it too much magic. Working with groups seems better.

--Hardy


On May 22, 2012, at 8:33 AM, Gunnar Morling wrote:

> Right. I guess what I'm just not totally comfortable with is the fact that, when looking at an entity, it gets a bit more complicated to understand whether a @NotNull constraint is validated or not.
> 
> By defining a validation group such as @PreUpdate and putting the @NotNull constraint into that group a user could solve the issue in an easy-to-understand way leveraging the existing mechanisms.
> 
> I see that such a feature would probably help to give a better "it-just-works" experience. But one could also argue that using a sequence (or another id generation strategy not providing a value before the insert) and a @NotNull constraint within a group which is validated upon insertion represents an inconsistency within the data model.




More information about the beanvalidation-dev mailing list