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

Guillaume Smet guillaume.smet at gmail.com
Mon Jan 8 07:04:49 EST 2018


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


More information about the hibernate-dev mailing list