[jboss-user] [EJB 3.0 Users] - EJB 3.0 lookup from Pojo and Injection

MirekSz do-not-reply at jboss.com
Tue Dec 1 02:34:50 EST 2009


Hello,
I have a question, I have

  | @Stateless
  | public class AccountServiceBean implements AccountService{
  | 
  | }
  | 
  | @Stateless
  | public class InvoiceServiceBean implements InvoiceService {
  | 
  | @EJB
  | AccountService accountService; 
  | 
  | public void doIt(){
  | SimplePojo simple = new SimplePojo();
  | simple.search();
  | 
  | }
  | 
  | }
  | 
  | public class SimplePojo{
  | 
  | 
  | public void search(){
  | 
  | 	Context context = new InitialContext();
  | 	AccountService accountService =(AccountService)context.lookup("AccountServiceBean /local");
  | }
  | 
  | }

Now my question I injectiong AccountService into InvoiceServiceBean , and invoke doIt inside it I create pojo and lookup for AccountService. If I can be sure that injected object AccountService will be the same lookup object??? I think that is the same reguest context

Best regards

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

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



More information about the jboss-user mailing list