3 Replies Latest reply on Apr 2, 2008 3:43 PM by Guillaume Jeudy

    Understanding the seam attribute injection

    Vassiliy Dubkin Newbie

      I've a question regarding the injection of attributes. For example I've an authenticator class which stores to
      User class in session scope. Code snippet:


      @Out(required = false, scope = SESSION)
      
      private User user;
      
      
      public boolean authenticate() {
      
          // preparing and executing a query
      
          user = results.get(0);
      
      }




      As far as I understand, seam puts the user object with the name user in the session, so that I can get it
      in other classes by using


      @In private User user;



      Is that correct? Now, if I have another class which is responsible for the user management with the following code:


      @DataModel
      
      private List<User> userList;
      
      
      @DataModelSelection
      
      private User user;



      Everything should work without any problems. But if I use


      @Out(required=false)
      
      @DataModelSelection
      
      private User user;



      I will get trouble, since seam loads the selected row and stores it in the session and overrides the logged in user object with the data model selection. Am I right? Can other problems occur with that code snippet?