0 Replies Latest reply on Jun 24, 2009 6:42 PM by mwinter1

    Show validation errors without real hibernate model based validation exceptions

      Hi,


      we've got several ejbs which contain entities and services and should be presented by a seam frontend. We're now facing the problem that theres no elegant solution to show valdiation exceptions which are specific to our business services in another way than jsf-global.
      As far as the documentation goes there are three possible ways to show a validation exception:



      1. As a global JSF message

      2. HTML-Field specific by hibernate validation

      3. HTML-Field specific by JSF addMessageToComponent Method



      The first option isn't good if the validation can be tracked down to a property of a bean represented by a field/component in the page. The second option is very elegant but only works with hibernate validations. The third option would work for us but its hard to keep a mapping of view-id to bean-property.
      So my question is: Assuming we have the following information about a failed validation:



      • class of entity bean

      • name of property

      • cause of validation exception



      Could we somehow manually raise a hibernate validation exception, which encapsulates this information and view it using the

      <s:validate>

      tag without using hibernate validation annotations on the entity beans?
      Or is there a best practice for mapping the id to an validation exception using JSF option number 3?


      Thanks in advance.