The @EJB when used in class label its use to declare the JNDI name in its name attribute... right?
Now I am confused
In the below code can you please tell me why @PersistenceContext(name="persistence/InventoryAppMgr") is needed as
the code is doing lookup()
is without @PersistenceContext(name="persistence/InventoryAppMgr") lookup is not possible in SessionContext?
@PersistenceContext(name="persistence/InventoryAppMgr")
@Stateless
public class InventoryManagerBean implements InventoryManager {
@Resource SessionContext ctx;
public void updateInventory(...) {
...
// use context lookup to obtain container-managed entity
// manager
EntityManager em =(EntityManager)
ctx.lookup("persistence/InventoryAppMgr");
...
}
}