0 Replies Latest reply on Jun 17, 2007 5:21 AM by Kristoffer Carnmarker

    How do I extend MessageInterpolator?

    Kristoffer Carnmarker Newbie

      Sorry if this is not the right forum, but I couldn't find a dedicated Hibernate Validator forum.

      In my application, I have validation on a field which changes dynamically, at runtime. Thus, the error message displayed to the customer needs to be dynamic as well. This means that I cannot use a ResourceBundle. The reference docs state that I can extend MessageInterpolator and refers to the JavaDocs, but the JavaDoc has next to no documentation. I have tried to debug my way through all this, but I am not getting very far.

      So far I have deduced (probably incorrectly) that I need to register the MessageInterpolator with the property "hibernate.validator.message_interpolator_class", and I (think) I have done so. However, its interpolate method is never called.

      I am using JBoss Seam, and have registered it in persistence.xml by adding the following:

      <property name="hibernate.validator.message_interpolator_class" value="com.x.x.x.BBMessageInterpolator"/>

      Can anybody shed some light on how to actually get the extended MessageInterpolator to be used?