0 Replies Latest reply on May 14, 2007 1:02 AM by joeyxxx

    Injection of Session javabean into event javabean not workin

    joeyxxx

      I'm running 1.2.1 with facelets on JBoss 4.05 EJB3 profile and using pojos not EJBs. This is my first attempt at seam and the ff issue has thrown me for a bit of a loop.
      The user component injected into balance is always null and it seams that I can only reference it is explictly using the ff

      (User) Contexts.getSessionContext().get("user");



      @Name("user")
      @Scope(SESSION)
      public class User implements Serializable
      {
       private String userName;
       private String password;
       private String userRole;
       private String segment;
       private String firstName;
       private String lastName;
       private String destination;
      
       public User(String firstName, String lastName, String userName, String password)
       {
       this.firstName = "James";
       this.lastName = "Bond";
       this.password = password;
       this.setUserName(userName);
       this.setUserRole("Investor");
       }
      
       public User() {}
      
      


      
      @Name("balance")
      @Scope(EVENT)
      public class Balance implements Serializable
      {
       private double totalMarketValue;
       private double cash;
       private double margin;
       private String userName;
       @In
       private User user;
       @Logger Log log;
      
       public Balance() {
       this.setTotalMarketValue(0);
       this.setMargin(0);
       this.setCash(0);
       if(user!=null){
       this.setUserName("Balance User:"+this.user.getUserName());
       } else {
      //This always works!!!
       user = (User) Contexts.getSessionContext().get("user");
       this.setUserName("Null @In "+this.user.getUserName());
       }
       }
      
      


      Are there any disadvantages to using javabeans instead of EJBs if one doesn't care about transactions etc? Is clustering better with EJBs on JBoss?
      Thanks