Hi,
I have quite a simple issue:
One entity (let's name it History) has 2 fields:
Date validFrom;
Date validTo;
I want to ensure that validTo is [u]after[/u] validFrom.
My first idea was to define my own field validator that I put on validTo but I can only access the value from the property itself, thus not possible to inspect validFrom...
Of course I can write a method like that:
@AssertTrue
public boolean validateToAfterFrom() {
return validTo.after(validFrom);
}
but then the validation is entity wide and I cannot know on my screen that I have to write an error message on validTo specifically...
Any solution to this problem that seems really standard ??
(either be able to inspect the whole entity or be able to specify on which field an AssertTrue function works)
Thx very much
vincent
[b]Hibernate version: 3.2.2 GA[/b]
[b]Hibernate Validator version: 3.0.0 GA[/b]
[/u]
|