I use model driven actions and want to use validation by annotation.
so I have somethings like:
@Validation
public Class ...Action implements ...{
...
@VisitorFieldValidator(message = "", appendPrefix = false)
public TestModel getModel() {
return testModel;
}
...
in the model class TestModel I have:
@Validation
@Entity
@Table(name = "...")
public class TestModel implements IPersistable {
...
@VisitorFieldValidator(message = "")
public void setSubModel(SubModel subModel) {
this.subModel = subModel;
}
...
(beside validation you see some hibernate annotations)
Now the problem I see when debugging (JBoss 4.0.3SP1) is:
the first VisitorFieldValidator is recognized correctly, but within the
TestModel class no annotations at all are found!
when I write a simple unit tests which does pretty the same then in the
validation annotation logic of struts2 / xwork, I get the annotation!
What is difference / problem here?
the units tests found the Annotation (size of array = 1),
debugging real application shows size = 0
(yes I am sure I have deployed the same class which is used in Unit Test)
Part of Unit Tests (which works) is:
@Test
public void testGetAnnotation() {
TestModel testModel = new TestModel();
Method[] methods = testModel.getClass().getDeclaredMethods();
for (Method method : methods) {
if(method.getName().equals("setSubModel")){
System.out.println("method: " + method.getName());
Annotation[]annotations = method.getAnnotations();
System.out.println("annotation size: " +
annotations.length);
}
}
}
Any help highly appreciated,
thank you in davance
--
View this message in context:
http://www.nabble.com/-S2--validation-annotation-problem-tf4684043.html#a13384745
Sent from the Struts - User mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]