4 Replies Latest reply on Feb 23, 2007 12:05 PM by Marco Huber

    How does bijetion with new object references works?

    Marco Huber Newbie

      Hi all,

      I have a question how bijection an object references works.

      I have the following situation:
      1. From a DataModel in overview page I outject an entry to details page.
      2. From this page I outject the entry to a edit page.
      3. Here I call a session bean via remote access and get a changed entry back.

      If I assign this changed object to the variable in my action bean and outject it I get it on the next page correct. In my DataModel it is already the entry with the unchanged value.

      So I seems to me that the object reference is not updated correctly.

      Here a code fragment that only outject the entry but no update the data table reference:

      @Stateful
      @Name("userAction")
      @Scope(ScopeType.CONVERSATION)
      public class UserActionBean implements UserAction, Serializable {
      
       @In(required=true)
       @Out(required=true)
       private User user;
      
       public String refreshUser() {
       UserManager userManager = getUserManager(); // Get the remote session bean
       user = userManager.refreshUser(user);
       return "userDetails";
       }
      }
      


      If I take the old entry and set the values from the changed entry I don't loose any datas.

      @Stateful
      @Name("userAction")
      @Scope(ScopeType.CONVERSATION)
      public class UserActionBean implements UserAction, Serializable {
      
       @In(required=true)
       @Out(required=true)
       private User user;
      
       public String refreshUser() {
       UserManager userManager = getUserManager(); // Get the remote session bean
       User tmpUser = userManager.refreshUser(user);
       user.setName(tmpUser.getName());
       user.setFirstName(tmpUser.getFirstName());
       // ... more set actions
       return "userDetails";
       }
      }
      



      Maybe I missing something, but I thought that the reassignment of the variable should work.

      Regards
      Marco