Thanks guys. Especially the already discussed topic really helped me the see points. I am glad that at least I have one working solution but maybe finalizing discussed topics would be great. We rely on more and more Bean Validation by utilizing extensive database connections. Alternatives to XML binding -  personally believe that it is a little bid error prone - will be inevitable after the wide adaption of the bean validation among frameworks such as Spring, Guice etc. Definitely having a simpler way for seperating constraint annotation and constraint validation into the modules will be mandatory. Despite of a great summary for possible solutions by Emmanuel, It can be great to revisit this topic.<div>

<br></div><div>Thanks </div><div><br></div><div><span style="font-size:14px;font-family:Arial,sans-serif"> </span></div>
<div><br><div class="gmail_quote">On 27 May 2012 13:44, Gunnar Morling <span dir="ltr">&lt;<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


Hi,<br>
<br>
If I understand you correctly, your question is related to the cyclic<br>
dependency between constraint annotations and constraint validators.<br>
<br>
As of BV 1.0 I don&#39;t see another way than using an XML constraint<br>
mapping as already suggested by Matt and Hardy.<br>
<br>
There was a discussion on the subject within the EG a while ago [1],<br>
but we didn&#39;t really come to a conclusion back then. One idea was to<br>
employ the service loader mechanism to contribute validator<br>
implementations [2]. I still think that&#39;s quite promising.<br>
<br>
--Gunnar<br>
<br>
[1] <a href="http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000064.html" target="_blank">http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000064.html</a><br>
[2] <a href="http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000075.html" target="_blank">http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000075.html</a><br>
<br>
<br>
<br>
2012/5/25 Cemo &lt;<a href="mailto:cemalettin.koc@gmail.com" target="_blank">cemalettin.koc@gmail.com</a>&gt;:<br>
<div><div>&gt; Hi,<br>
&gt;<br>
&gt; I am not sure is this already discussed or not but currently I believe that<br>
&gt; validation spec is very strict about coupling.<br>
&gt;<br>
&gt; For example at interface level validator is declared by Interface.<br>
&gt;<br>
&gt; @Constraint(validatedBy = EmailValidator.class)<br>
&gt; @Retention(RUNTIME)<br>
&gt; public @interface Email<br>
&gt;<br>
&gt;<br>
&gt; And for the part EmailValidation part, we are referring again our Email<br>
&gt; Interface<br>
&gt;<br>
&gt; public class EmailValidator implements ConstraintValidator&lt;Email, String&gt;<br>
&gt;<br>
&gt; What I think is this contract is little tight. And because of the strict<br>
&gt; contract, splitting validation by its interface is not possible.<br>
&gt;<br>
&gt; And let me to clarify my use case too.<br>
&gt;<br>
&gt; I have splitted my domain, validation and web projects (Web1, Web2, Web3)<br>
&gt; and using spring extensively.<br>
&gt;<br>
&gt; Domain (Has no dependency)<br>
&gt; Validation (Has dependency to validation spec and optionally Spring<br>
&gt; Framework. For example, It can validate an uniqueEmail field by checking<br>
&gt; database. )<br>
&gt; Web&#39;s (Has dependency to validation and domain)<br>
&gt;<br>
&gt; My domain needs dependency to validation for validating it but it means also<br>
&gt; depending spring and all other stuffs regarding Database validations. What I<br>
&gt; want to split Validation contract to interfaces and implementations.<br>
&gt; Interfaces could be declared at domain and implementations reside at<br>
&gt; validation module. Validation module has a dependency to domain perfectly.<br>
&gt;<br>
&gt; I have checked builtin constraints implementations but it seems there is not<br>
&gt; any extensible points for it.<br>
&gt;<br>
&gt; What are your suggestions for this situation?<br>
&gt;<br>
&gt; Thanks<br>
&gt;<br>
&gt;<br>
</div></div><div><div>&gt; _______________________________________________<br>
&gt; beanvalidation-dev mailing list<br>
&gt; <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
&gt;<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>
</div></div></blockquote></div><br></div>