2 Replies Latest reply on Mar 5, 2009 9:12 AM by Andre Lode

    Problem with hibernate validator

    Andre Lode Newbie

      Hello community,

      I'm a newbie in seam and I want to create a test application. Therefor I use hibernate and jpa as persistence layer, spring and icefaces with facelets. The application runs on a Tomcat 6.0 and the deployment process is done by maven. I want to validate the userinputs of an ice:form against the hibernate validator. The required=true attribute works fine but when I enter 2 digits for the zipCode (@Length(min = 3)) I get an

      org.hibernate.validator.InvalidStateException: validation failed for: poc_icefaces.model.User

      and the form site isn't redisplayed.

      Here is my code:


      public class UserServiceImpl implements UserService {
              private EntityManager em;
              @In (required = false, scope = ScopeType.CONVERSATION)
              @Out(required = false, scope = ScopeType.CONVERSATION)
              private User user;
              public String editUser(User selectedUser) {
                      user = em.merge(selectedUser);
                      return "edit";
              public void saveUser() {

      User.java (entity):

      public class User {
              private Long id;        
              private String zipCode;
              @Id @GeneratedValue
              public Long getId() {
                      return id;
              public void setId(Long id) {
                      this.id = id;
              @Length(min = 3)
              public String getZipCode() {
                      return zipCode;
              public void setZipCode(String zipCode) {
                      this.zipCode = zipCode;


        <h:inputText id="zipCode" value="#{user.zipCode}" required="true">
          <s:validate />
        <h:message for="zipCode"/>                             


      <page view-id="/protected/user/editUser.jspx">
        <action execute="#{userService.saveUser}" if="#{validation.succeeded}" />
        <navigation from-action="#{userService.saveUser}">
          <redirect view-id="/protected/user/userManagement.jspx" />

      I hope you can help me ...