POJO annotation-based validation doesnt work on collections?

27 views
Skip to first unread message

Dave

unread,
Jan 8, 2011, 6:54:58 PM1/8/11
to play-framework
When I attempt to validate (@Valid) a POJO with a child POJO, the
validation works correctly:

public class POJO {
public POJO2 someMemberIWantValidatedToo;
}

However, if POJO2 is in a collection, it seems to get skipped over:

public class POJO {
public List<POJO2> lotsOfMembersIWantValidated;
}

Is this a bug or is there another way of doing this that I'm unaware
of? I tried to write my own custom validator (http://pastebin.com/
ggwQgWDP), but I cannot create the proper error key because
ValidationPlugin.keys is package private (probably as it should be).
Outside of a custom validator, I'm not sure how to handle this unless
we make the @Valid annotation applicable to classes too.

Alison Winters

unread,
Jan 9, 2011, 1:40:51 PM1/9/11
to play-framework
Reply all
Reply to author
Forward
0 new messages