FYI this is not the only problem with Bean Validation and CDI client proxies. See also my last comment on CDI-10 [1] and the question posted on the HV forum [2].
Martin [1] https://issues.jboss.org/browse/CDI-10?focusedCommentId=13069965&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13069965 [2] https://forum.hibernate.org/viewtopic.php?f=26&t=1039523 Dne 27.5.2015 v 01:12 Emily Jiang napsal(a): > It seems Weld proxy has the same annotations as the proxied class. > However this conflicts with Bean validation spec as far as @Valid is > concerned. > > > This section of the bean validation spec is ending up in violation due > to the duplicated annotation: > • One must not mark a method return value for cascaded validation more > than once in a line of a class hierarchy. > In other words, overriding methods on sub types (be it sub > classes/interfaces or interface implementations) cannot mark the return > value for cascaded validation if the return value has already been > marked on the overridden method of the super type or interface. > > "The @Valid annotation is used to declare that a cascaded validation of > the given method/constructor parameters or > return values is performed by the Bean Validation provider. " > > > Here is some debug added to the apache bean validation code that shows > which two classes have the @Valid on the createValidEvent method: > > $$$$$$$$$$$$DEBUG clazz = class > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarServiceWithCascadingReturnValue$Proxy$_$$_WeldSubclass > method = public > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.Event > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarServiceWithCascadingReturnValue$Proxy$_$$_WeldSubclass.createValidEvent() > $$$$$$$$$$$$DEBUG clazz = class > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarServiceWithCascadingReturnValue > method = public > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.Event > org.hibernate.beanvalidation.tck.tests.integration.cdi.executable.CalendarServiceWithCascadingReturnValue.createValidEvent() > $$$$$$$$$$$$$$$$$DEBUG returnValid = 2 // number of hits having @Valid > > If I understand correctly, I think this annotation needs to be treated > differently. > -- > Thanks > Emily > ================= > Emily Jiang > [email protected] <mailto:[email protected]> > > > _______________________________________________ > weld-dev mailing list > [email protected] > https://lists.jboss.org/mailman/listinfo/weld-dev > -- Martin Kouba Software Engineer Red Hat, Czech Republic _______________________________________________ weld-dev mailing list [email protected] https://lists.jboss.org/mailman/listinfo/weld-dev
