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"); 

I wonder if my approach is totally off. Maybe I should be using some kind of 
factory object that Outjects the balance object. 
This is the Class I'm Trying to Inject.

  | @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() {}
  | 
  | 


This Is the Class I'm trying to Inject Into.

  | 
  | @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

View the original post : 
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4045556#4045556

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4045556
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to