-
1. Re: Validation annotations on private fields
pmuir Jan 14, 2008 10:20 AM (in response to rhasselbaum)No, they should work just fine.
Maybe post some details of your problem? -
2. Re: Validation annotations on private fields
rhasselbaum Jan 14, 2008 11:13 AM (in response to rhasselbaum)Well, if I annotate a private field with, say, @Length(max=50) and validate a form, invalid data doesn't get flagged. But when I move the same annotation to the corresponding property getter, validation works perfectly.
Hmm... I wonder if it has anything to do with my naming convention for private fields. I use an "m_" prefix. Maybe this prevents Seam from determining the property name. Is there a Seam equivalent to Hibernate's NamingStrategy interface, so I could tell it how to translate field names to property names? -
3. Re: Validation annotations on private fields
pmuir Jan 14, 2008 12:35 PM (in response to rhasselbaum)You would need to ask on the Hibernate Validator forum. Seam just gives hibernate validator a property name and a value and asks it to validate them.
-
4. Re: Validation annotations on private fields
rhasselbaum Jan 14, 2008 1:33 PM (in response to rhasselbaum)Confirmed, it is the "m_" prefix on the private field names that is throwing it off. If I get rid of it, validation works fine.
I'll just annotate the getter methods. Not a big deal.