2 Replies Latest reply on Jan 11, 2007 9:39 AM by c_eric_ray

    Forced Outjection

      I have the following situation...


      1. user logs in
      2. user object is outjected
      3. work is done
      4. backend process updates user in database
      5. bean notices user update and refreshed from database


      I need the refreshed user data to be outjected however it is not

      public class LoginAction {
       private UserEntity user;
      
       @Out(required=false, scope=ScopeType.SESSION)
       public String getUser() {
       return user;
       }
      }
      
      public class AnotherBean {
       @In(required=false) @Out
       private UserEntity user;
      
       public void method() {
       // update user with current data and have it outjected to other objects
       user = em.find(UserEntity.class, user.getId());
       }
      }
      
      public class ThirdBean {
       @In(required=false)
       private UserEntity user;
      
       public void method() {
       // do something with user
       // however user contains the old data not the new data from the database
       }
      }
      


      Is this possible? Am I doing it wrong? I guess I can always go to the database, but I kind of like the idea of using seam to manage this object.

      Thanks.

        • 1. Re: Forced Outjection

          You have to define some way to inform the frontend that _something_ has changed in the backend.

          I assume that the modification of the data relevant to the user object exists only in the database so therefore you can't simply outject the modified user object after the "work is done" phase.

          Then the only choice you have is to refresh the user object from the db after step 4 and outject it then.

          Regards

          fhh


          BTW: This is a mistake, is it?

          public class LoginAction {
           private __UserEntity__ user;
          
           @Out(required=false, scope=ScopeType.SESSION)
           public __String__ getUser() {
           return user;
           }
          }
          


          • 2. Re: Forced Outjection

            Yeah, should be UserEntity.