2 Replies Latest reply on Sep 22, 2006 4:56 AM by lara

    Problems with the update method in Jboss Seam + Hibernate

    lara

      I have an entity bean called Actor and a stateful session bean called ActorEditorBean. The database table for the entity bean contains many fields, one of them is "name" which should be unique. When I try to create an actor, I make sure first that there is no existing actor with that name since it should be unique. If it happens that the name is already used, I return an error message and the actor could not be created unless the name is changed. This works perfectly but the problem is that when I want to update an actor, the same process should be done. I tried to follow the code step by step but I am not able to know when exactly the update is done. It seems that even without calling the update method explicitly, it is being called implicitly or maybe because of the entity manager. I would be very thankful if anyone can help!

        • 1. Re: Problems with the update method in Jboss Seam + Hibernat
          gavin.king

          Right, EJB persistence operations happen asynchonously. Call flush() if you want to force an update to occur.

          • 2. Re: Problems with the update method in Jboss Seam + Hibernat
            lara

            Thanks for replying. The problem is that a user is editing actor information and when clicking on the update method, I have to check if the name is not already saved to the database. What I am doing, is checking first if the name is unique but what is happening is that the update is occuring implicitly before I can make the checking so everytime I will get an error message saying that the name is unique because it has been saved to the database when the update took place. How can I solve this? I want to be able to do the checking before the update action takes place. Thank you in advance.