I think that for different homes there are different contexts.
I think that it is required to implement ejb-ref semantics in
XML DD.

<ejb-ref>
<ejb-ref-name>ejb/EmplRecords</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.wombat.empl.EmployeeRecordHome</home>
<remote>com.wombat.empl.EmployeeRecord</remote>
<ejb-link>EmployeeRecord</ejb-link>
</ejb-ref>

ebj-ref.ejb-ref-name may be the same for
different types in different contexts.

BTW I'm very amused why not return JNDI Context from
EJBContext. There will be the same URL for all beans
and it will be simpler and faster to get it from
EJBContext then to create it in specific bean context.
(Vlada or Mark, could you please explain it?).

Considering it, implementing support for example
in B7 (p 288) in nontrivial. It is implementable
for example by setting thread context for bean
before bussiness method call, but why container
implementers need to deal with those problems
at all.

from ejb spec 1.1 public draft (p 288)
> B.7 How to obtain database connections
>
> ...
>
> public class EmployeeServiceBean implements SessionBean {
>   EJBContext ejbContext;
>   public void changePhoneNumber(...) {
>     ...
>     // obtain the initial JNDI context
>     Context initCtx = new InitialContext();
>     // perform JNDI lookup to obtain resource factory
>     javax.sql.DataSource ds = (javax.sql.DataSource)
>     initCtx.lookup("java:comp/env/jdbc/EmployeeAppDB");
>     // Invoke factory to obtain a resource. The security
>     // principal for the resource is not given, and therefore
>     // it will be configured by the Deployer.
>     java.sql.Connection con = ds.getConnection();
>     ...
>   }
> }


Constantine

Rickard �berg wrote:
>
> On EJB1.1 bean JNDI environment.
> In EJB1.1 the bean retrieves contextual info from the "java:comp/env"
> JNDI name.
>
> Q: is this naming context local to each bean?
> I.e. if two beans lookup "java:comp/env" should they receive different
> contexts, or should they get the merged context of all beans?
> It seems from the spec as this would be contextual. This introduces some
> interesting implementation issues for container implementors (solvable,
> but still).
>
> Any ideas would be appreciated!
>
> /Rickard
>
> --
> Rickard �berg
>
> @home: +46 13 177937
> Email: [EMAIL PROTECTED]
> Homepage: http://www-und.ida.liu.se/~ricob684
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff EJB-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff EJB-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to