Fixed
Details
Assignee
Gunnar MorlingGunnar MorlingReporter
Cédric CCédric CLabels
Participants
Cédric CGunnar MorlingComponents
Fix versions
Affects versions
Priority
Major
Details
Details
Assignee
Gunnar Morling
Gunnar MorlingReporter
Cédric C
Cédric CLabels
Participants
Cédric C
Gunnar Morling
Components
Fix versions
Affects versions
Priority
Created January 21, 2015 at 1:11 PM
Updated July 15, 2015 at 12:12 PM
Resolved February 19, 2015 at 7:58 PM
I want to set some constraints programmatically using the fluent API, because they depend on the case for example a min and max of a
@Size
constraint could vary or a field could be@NotNull
or not...But I can't use the fluent API in a JavaEE environment to configured programmatically the
Validator
orValidatorFactory
WildFly is providing to JSF or JPA (more info on this post: http://stackoverflow.com/questions/27970745/hibernate-validator-programmatic-constraints-declaration-and-jsf)The configuration of constraints could vary among the users of the app, so the configuration of
Validator
/ValidatorFactory
should depends on a scope@SessionScoped
at least and maybe@ApplicationScoped
configured constraints programmatically at the application scope could allow managers of the application to change constraints with a web interface without changing the code of the application and even without restart the application (constraints could be saved in a database)
configured constraints programmatically at the session scope could allow users to have differents constraints according to what there are doing. Ex: In an application who managed calls of projects, the constraints could depend on the call of project, so according to the call of project a user could have a specific set of constraints to applied, while others users, in the same time, could have others sets of constraints.
In both case the programmatic configuration could rely on injection, the "configurator" could have an injected (@Inject) EJB to access a database, in the case of a session scoped configuration
@SessionScoped
EJB could be injected to provide informations about the state of the sessionSo it's an improvement to integrate the fluent API in JavaEE environment in general or at least in WildFly
IMHO The fluent API is really a good idea and shoul be part of the Bean Validation spec...
Thank you for your work