[jboss-user] [JBoss Seam] - Can I inject a session bean into a stateless session bean?

gus888 do-not-reply at jboss.com
Thu Jan 17 12:05:56 EST 2008


Hi, 

I am not sure whether I can inject a session bean (e.g. currentUser) into a stateless session bean, and each user will have his owner username in the stateless session bean when he/she call it. For example:@Stateless
  | @Name("friend")
  | public class FriendAction implements Friend {
  | 
  |   @In
  |   private Person user;
  |  
  |   @Out
  |   private List <Person> friends;
  | 
  |   @PersistenceContext
  |   private EntityManager em;
  |  
  |   public void retrievFriends () {
  |     friends = em.createQuery("select pf.friend from PersonFriend pf where pf.person.id=:userId")
  |     			.setParameter("userId", user.id());
  |              	.getResultList();
  |   }
  | 
  | }Thank you.

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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4121014



More information about the jboss-user mailing list