I have a bean class with multiple (custom) inner constraints and one class-level constraint. I'd like to validate the inner constraints before the class-level constraint. The code looks like this:
@GroupSequence({ Inner.class, NewSlotBean.class })
@TotalBeanValid(groups = NewSlotBean.class)
public class NewSlotBean {
@DayMonthYearString(groups = Inner.class)
private String slotDay;
@TimeString(groups = Inner.class)
private String slotBegin;
@LengthString(groups = Inner.class)
private String slotLength;
}
(Inner
is just an empty interface lying around somewhere).
However, when I try to run this, the class-level constraint does not get validated at all. When I try to define the GroupSequence like
@GroupSequence({ Inner.class, Outer.class })
(with Outer
being a random interface), I get the exception:
javax.validation.GroupDefinitionException: ...*.beans.NewSlotBean must be part of the redefined default group sequence.
Does s/o know how to make sure that the class-level constraint is validated after the inner ones? (This appears not to be the default! I've had random problems with it popping up after a while.)