[hibernate-dev] [HV] Extending ParameterNameProvider contract for other element types

Gunnar Morling gunnar at hibernate.org
Thu Sep 19 04:35:57 EDT 2013


I also think that the conversion of the ConstraintViolation(s) into another
format is more in the responsibility of the integrating technology.

Taking JAX-RS/Resteasy as example, it will transparently convert any
constraint violation objects into an equivalent XML or JSON response.
Provided we return the wished property name in the reported violation,
Resteasy's conversion would take over from there.


2013/9/19 Hardy Ferentschik <hardy at hibernate.org>

>
> On 19 Jan 2013, at 9:44 AM, Emmanuel Bernard <emmanuel at hibernate.org>
> wrote:
>
> > It seems that what this user really needs is a way to convert the
> Set<ConstraintViolation> into another format entirely, JSON in this case. I
> wonder if we could find a more generic approach than just the ability to
> change properties names.
>
> Well, there are really two problems. First the creation of the JSON format
> and then the property name "conversion". I think they need to be addressed
> separately. Even if we had/offered something to convert the constraint
> violations, we still
> would report the actual property name.
>
> In the described use case I would write the conversion code myself. The
> constraint violation contains all the information needed to create the JSON
> format and do the name conversion. It should not be hard to write.
>
> --Hardy
>
>
> _______________________________________________
> 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