3 Replies Latest reply on Apr 23, 2007 5:23 AM by pmuir

    EntityHome question

    emsa

      Hi,

      I'm trying to "veto" an update in MyHome by overriding the update() method like this:

      public String update() {
       if(!valid()) {
       return null;
       }
       return super.update();
      }
      


      My problem here is that the "UPDATE" request to the database is issued even if ''super.update()'' never is called.

      Is there anyway to stop the "UPDATE" from being issued or do I have to solve this by not using the Home infrastructure ?

      /Magnus

        • 1. Re: EntityHome question
          pmuir

          By this point the model has been updated. A flush occurs as EJB3 automatically flushes the PC at method boundaries, you can turn this off by using a flushMode=MANUAL conversation.

          • 2. Re: EntityHome question
            emsa

            Ok,
            been away from seam for a while but previously I always used "em.merge( .. )" when handling objects in Conversations. Has something changed in seam in regarding to Transactions/Conversations (maybe the Homes are using Extended-PCs or something else I have not used yet?)

            • 3. Re: EntityHome question
              pmuir

              A home uses an SMPC (which is like an EJB3 EXTENDED PC but for the scope of the conversation which means your entities don't become detached during the conversation) so there is no need to merge.