Home   Up About   Documents   Products  

EJB @EJBs

Javadoc

The @EJBs annotation makes it possible to define EJBs that you are going to lookup at runtime in your EJB. See the example below for more information.

  
  @EJBs(value={
    @EJB(name="ShoppingCart"),
    @EJB(name="AddressBook")
  })
  @Stateful
  public class ShoppingSessionBean {

    @Resource
    SessionContext ctx;

    public List getItems() {
      ShoppingCart cart = (ShoppingCart) ctx.lookup("ShoppingCart");
      return cart.getItems();
    }
  }
                

Copyright © 2003-2009 Manorrock.com. All Rights Reserved.