[hibernate-dev] Feedback on Bean Validation JAX-RS integration

Hardy Ferentschik hardy at hibernate.org
Fri Jul 1 08:55:37 EDT 2011


On Thu, 30 Jun 2011 22:04:39 +0200, Gunnar Morling  
<gunnar.morling at googlemail.com> wrote:

> Some minor remarks:
>
> * In listing 2 setEmail() instead of a getter is annotated.
>
> I'm not sure whether this is intentionally, otherwise it would make
> sense to use getters as in BV.

Good catch. I was assuming getters. Need to check whether this is really
intentionally.


> * "The order in which validations are checked is as follows:
> constraint validations on fields and properties are checked first, on
> resource classes are checked next"
>
> I don't think we could currently ensure such an order in HV but I
> guess it could be implemented. The question is whether this is really
> required.

I understood this to be more of a JAX-RS thing. I thought that there is a
way for same in the framework to distinguish between form parameter  
processing
and "resource class populating". If so it is just a question where and how
to call the validator. After re-reading the examples I am not so sure
anymore. The examples just use MyResourceClass, but still seem to  
distinguish
between resource class and non resource class.


> * "If the getUser() method in [the implementing class] MyResourceClass
> is decorated with any annotation ... all of the annotations in the
> [implemented] interface will be ignored.

> I think this might require some more consideration. In HV we decided
> against such an approach, as preconditions shouldn't be strengthened
> in sub-types in order to obey to the Liskov substitution principle
> [1].
> Instead of the very conservative approach currently taken by HV (not
> allowing parameter constraints for one method in several places in a
> hierarchy)

I wonder what they think about this approach?

--Hardy



More information about the hibernate-dev mailing list