<div dir="ltr">I've created <a href="https://hibernate.onjira.com/browse/BVAL-357" target="_blank">https://hibernate.onjira.com/browse/BVAL-357</a><div><br></div><div>> <span style="font-family:arial,sans-serif;font-size:13px">I think you should call isReachable and isCascadable for params and return values.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">> </span><span style="font-family:arial,sans-serif;font-size:13px">Of the top of my head I cannot think of a reason why we would need to use isReachable on a parameter</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">So do you think isReachable() *is* required or not? Regarding your entity example, did you mean it like this:</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">@Entity</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">public class Customer {}</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">public class CustomerService {</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"> public void updateCustomer(@RetailCustomer @Valid Customer customer) {</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"> }</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">}</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div><span style="font-family:arial,sans-serif;font-size:13px">Then I guess it would indeed make sense to call isReachable() and isCascadable() when validating the "customer" parameter.</span></div>
<div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><span style="font-family:arial,sans-serif;font-size:13px">--Gunnar</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br>
</span></div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/1/10 Emmanuel Bernard <span dir="ltr"><<a href="mailto:emmanuel@hibernate.org" target="_blank">emmanuel@hibernate.org</a>></span><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">That's an interesting question. I think you should call isReachable and isCascadable for params and return values.<br>
Imagine a constraint validating a JPA entity. You don't want it to be validated if the entity is a proxy. This constraint could access a few of the entity state properties. And that's before cascading.<br>
<br>
isCascadable was a contract added specifically so that the same entity would not be validated over and over if it happened to be referenced by several other entities in a dirty persistence context.<br>
<br>
Open an issue because we need to clarify all that in the spec.<br>
<br>
Emmanuel<br>
<br>
Of the top of my head I cannot think of a reason why we would need to use isReachable on a parameter<br>
<div><div><br>
On 9 janv. 2013, at 15:42, Gunnar Morling <<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>> wrote:<br>
<br>
> Hi all,<br>
><br>
> working on the TCK, I'm wondering whether a BV provider should use TraversableResolver#isReachable() and isCascadable()) to check whether a validated method parameter or return value may be accessed/traversed.<br>
><br>
> I think checking for cascadability might make sense, but I'm not so sure about checking for reachability; can e.g. be a parameter not reachable?<br>
><br>
> If any of the checks shall be done for method validation, we need to update the TraversableResolver contract (section 4.6.3) which currently explicitly speaks about properties and is limited to the element types FIELD and METHOD.<br>
><br>
> WDYT?<br>
><br>
> --Gunnar<br>
><br>
><br>
><br>
><br>
><br>
><br>
</div></div>> _______________________________________________<br>
> beanvalidation-dev mailing list<br>
> <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
</blockquote></div><br></div></div>