4 Replies Latest reply on Apr 3, 2009 12:19 AM by Arbi Sookazian

    Enrity dirty checking in flushMode=MANUAL

    Martin Goik Newbie

      I do have an Entity User and a corresponding UserHome with manual flushing enabled:



      @Name("userHome")
      @Scope(ScopeType.CONVERSATION)
      public class UserHome extends EntityHome<User> {
          ...
        @In(create=true ) private EntityInfoManager entityInfoManager;
        private String pw1, pw2;
          ...
        @Override
        public String update() {
          final User u = getInstance();
          ...
          if (someCondition) {
            return null;
          } else {
            u.setUserPassword(PasswordUtil.generateRandomSaltMd5Digest(pw1));
          } 
          getEntityManager().flush();
          return super.update();
        }
        @Override 
        @Begin(flushMode=FlushModeType.MANUAL, join=true)
        public void create() {
          super.create();
          //business logic code omitted
        }
      }



      The corresponding view user.xhtml contains:



      <h:commandButton id="update" value="Update" action="#{userHome.update}"
      rendered="#{userHome.managed}" />



      The User entity references other entities that may or may not be changed in the conversation and so far it works.


      Now I want to display this update button shaded as long as no entity has been changed. In other words: I want to know if the User instance object or any referenced object within the conversation is in a dirty state.


      I searched the Seam documentation and this (plus the former) Seam user's forum but did not find any hint.