3 Replies Latest reply on Jan 17, 2008 1:35 PM by Pete Muir

    Can I inject a session bean into a stateless session bean?

    Gus Gu Expert


      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:

      public class FriendAction implements Friend {
       private Person user;
       private List <Person> friends;
       private EntityManager em;
       public void retrievFriends () {
       friends = em.createQuery("select pf.friend from PersonFriend pf where pf.person.id=:userId")
       .setParameter("userId", user.id());
      Thank you.