4 Replies Latest reply on Nov 9, 2007 6:21 PM by Jacob Orshalick

    Losing web page state on validation error with HibernateEnti

    Joseph Celano Newbie

      I am using Seam 2.0 CR4 with Jboss 4.2 and Hibernate and my applications is deployed as a WAR.

      I have a simple page (startPage.xhtml) that links to another page (userInfo.xhtml) that is backed by a HibernateEntityHome object (UserHome.java). When i first navigate to the userInfo page, all works as desired. The user information is loaded and it appears that the entity is managed (e.g. the update button is displayed, not the add button).

      My problem is this, if there is a validation error (e.g. phone number not the correct format), then it appears that the entity is not managed anymore (e.g. the add button is displayed instead of the update button). What am i doing wrong?

      Any help would be appreciated. If you need more information or code, please let me know.

      Pages.xml snip...

       <page view-id="/userinfo.xhtml" login-required="true">
       <param name="id" value="#{userHome.id}"/>
       <navigation>
       <rule if-outcome="created">....</rule>
       </navigation>
       </page>
      


      Link snip....
      <h:outputLink value="userinfo.seam">
       <f:param value="#{user.id}" name="id"></f:param>
       User - Edit Current User
      </h:outputLink>
      


      UserInfoHome.java snip....

       @RequestParameter
       protected Integer id;
       public Integer getId() {
       log.info("getId() called id={0}", id);
       return id;
       }
      
      
       public void setId(Integer netkeyEntityId) {
       log.info("setId() called id={0}, netkeyEntityId={1}", id, netkeyEntityId);
       id = netkeyEntityId;
       }