2 Replies Latest reply on Mar 27, 2009 3:59 PM by edrusiani2009

    Bijection problem on entity bean

      Hi everyone.


      i'm using Seam 1.2.1 on JBoss 4.2.2 and Hibernate 3.1. i'm already preparing to upgrade to Seam 2, but that's not the problem.


      inside one of my action i'm using an entity bean and storing it inside the Session


      @In(required=false)
      @Out(required=false,scope=ScopeType.SESSION)
      private MyEntity registrazione;
      


      when i load the page, i start a conversation, initializing the entity with a new instance with some values but not jed persisted in Hibernate.


      when the user has compiled the form inside the same page and clicked on the insert button, i end the conversation and persist the data and the new registration, then i call a method that sets registrazione to null and exits the page.


      Sometimes (sorry to say, i don't know how to trigger the problem) the MyEntity, at the end of the conversation, is an actual Entity from the db.


      I'm sure the user has only one session opened and doesn't jump from one page to another, and the conversation part is needed for a special case, but the problem shows randomly on the simplest case possible.


      i've tried to figure out similar problems on documentations, books and forums, but i didn't find anything similar to my case, so any suggestion is more than welcome.


      Thanks for your time and help in advance, and sorry for my bad english


      Enrico






        • 1. Re: Bijection problem on entity bean
          gonorrhea

          Are you using @End or @End(beforeRedirect=true)?



          If set to true, instructs Seam to terminate the conversation prior to
          issuing a redirect. The default is to propagate the conversation
          across the redirect and terminate it once the response is complete.
          Default: false.

          show more code...

          • 2. Re: Bijection problem on entity bean

            thanks for your reply, i'll show as much code as i can, the code flow is made of lots of JNDI calls to stateful beans, making it quite intricate to post...


            i'm starting the conversation with



            @Begin (join=true)
            public String openArcReg() {
            
            logger.debug(" openArcReg start...");
            
            ...





            and i end it with



            @End
            public String insertRegistrazione(){
            
            logger.debug(" insertRegistrazione start ....");
            
            ...






            i've also tried to clean the variable using



            Contexts.getSessionContext().remove("riferimento");




            but i had no luck