[hibernate-dev] proposition to create a new Constraint for @Age

Gunnar Morling gunnar at hibernate.org
Wed Jan 10 15:12:21 EST 2018


Hi Hilmer,

Welcome to the list and +1 to that constraint. I think it's a good idea
overall, will comment on the PR on some details as needed.

Cheers,

--Gunnar


2018-01-08 13:04 GMT+01:00 Guillaume Smet <guillaume.smet at gmail.com>:

> Hi Hilmer,
>
> On Sat, Jan 6, 2018 at 9:10 PM, Hilmer Chona <hilac at msn.com> wrote:
>
> > I have created a new issue on Jira  HV-1552<https://hibernate.
> > atlassian.net/browse/HV-1552>, it is to add a new Constraint to check if
> > the number of years from a given date to today is igual or greater to a
> > specified value.
> >
> > This validation can be very useful when someone who wants to access, sign
> > up, or buy something must be over than one established age.
> >
> > What do you think?
> >
>
> Looks interesting. I think I would mimic what we do with Min/Max i.e. have
> AgeMin/AgeMax and an inclusive option.
>
> What I'm not sure about is if we should limit that to years. Or be more
> flexible and also support months/days for instance. But I'm not sure it's
> going to be easy (or useful?). Might be worth a try though.
>
> I would recommend doing an experiment with one date type before writing all
> the validators as it's going to be a bit tedious.
>
> I suppose you have seen Marko's post about how to contribute a constraint:
> http://in.relation.to/2018/01/04/adding-new-constraint-to-engine/ ?
>
> Have a nice day.
>
> --
> Guillaume
> _______________________________________________
> 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