users@glassfish.java.net

Re: Again an _at_Local Interface

From: <glassfish_at_javadesktop.org>
Date: Wed, 14 May 2008 07:33:33 PDT

There are two different issues : 1) defining the EJB dependency and 2) acquiring the EJB reference.

For 1), you can either define the ejb-local-ref in the associated ejb-jar.xml or web.xml. Or, you can use an @EJB annotation in a managed class within whose component environment your POJO will run

For 2), you can either inject into a managed class or lookup the dependency within the active component environment (java:comp/env).

What makes things different for POJOs is that they don't have their own component environment so they just use whatever environment they happen to be called from. Each EJB component has its own private component environment, so if the POJO is called from more than one EJB component and wants to do a lookup, you have to make sure you define the EJB dependency for each EJB component. It's different for a .war, where there is only one component environment for the entire web application.
[Message sent by forum member 'ksak' (ksak)]

http://forums.java.net/jive/thread.jspa?messageID=274294