+1 for adding something like this. Marcos, could you open an issue in our tracker (https://hibernate.atlassian.net/browse/BVAL)?

If you don't want to use the current dynamic constraint APIs in HV/Apache BVAL, you might consider to generate XML constraint descriptors based on your configuration. That's a bit more tedious but portable between providers.

Slightly related, I see people ask every now and then for a facility for copying constraint definitions between models. Users could build this themselves if aforementioned dynamic constraint definition was possible, or we could add some more high-level support for this.

--Gunnar




2014/2/25 Matt Benson <mbenson@apache.org>

I would be interested in getting dynamic constraint functionality into the BV spec. Between what Hibernate Validator offers and what is supported by the dynamic add-on for Apache BVal it shouldn't take us much to agree on an API.

Matt

On Feb 24, 2014 6:39 PM, "Marcos Antonio" <marcos_antonio_ps@hotmail.com> wrote:
Let me try to be a bit more clear.
Consider this entity:

@Entity
public class Employee
{
    private String _name;

    // ...

    @Size(min = 1, max = 50)
    public String getName()
    {
        return _name;
    }

    // ...
}

If some client of mine asked me to change the name of the employees to accept 70 characters because 50 is not enough anymore I have to change my application for all clients. But if the bean validation specification allowed me to configure the constraints dinamically I could do this configuration on a cliente basis. All I had to do was to change the database structure for the specific column, register this fact in some table of mine and in the application startup my application would check for changes and configure the corresponding bean constraint. With static constraints (as it is today) we don't have this flexibility.

Marcos

----------------------------

From: emmanuel@hibernate.org
Date: Mon, 24 Feb 2014 19:00:35 +0100
Subject: Re: [bv-dev] Configure validation constraints at runtime
To: beanvalidation-dev@lists.jboss.org; marcos_antonio_ps@hotmail.com

Hi
We don't have a defined roadmap for the future of Bean Validation. But that would be a nice addition in my opinion.

What's your use case for it?

Emmanuel
_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev

_______________________________________________
beanvalidation-dev mailing list
beanvalidation-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/beanvalidation-dev