1 Reply Latest reply on Mar 9, 2007 8:04 AM by fady.matar

    jboss seam and saving to the database

    hvram

      Hi
      I am using Seam 1.1.6 and I am facing the following problem

      " Trying to save values to the database redirects me to the Seam debug page on an exception . I am trying to redirect to my page but I am unable to do ".

      The following is what I have done

      -- I have a database table with constraints on the table ( unique )

      -- Used seam-gen and generated the code for the tables

      -- Wrote a new method in the entityHome to call the persist method

      public String handleRegistration( ) {
      try {
      persist();
      return "test"
      } catch (Exception e) {
      return null;
      }
      }

      -- I have entries in the navigation.xml to redirect the output on "test" to the proper page

      -- I have entries in the exceptions.xml file but that does not help . I also have the 'catch all' exception.

      Problem :
      On entering a non unique value I get redirected to the Seam's debug page . My understanding was that returning a null would show the same value .

      Can somebody tell me what I am doing wrong and what is the correct way of handling this

      Thanks

      Regards
      Hari

      PS : The rest of the features of JBoss Seam really rock . I am just unable to get this simple thing to work

        • 1. Re: jboss seam and saving to the database

          You're being redirected to the debug page because of a persistence exception.

          What you should do is handle this in the persist method.

          Override the persist method and in it check if there's already an object with this unique persistence and throw an error message in there.