Hi,
I suppose reference and link are used below with respect to ejb-ref-name and
ejb-link tags of the deployment descriptor. If this is true, see inline.
Otherwise, please skip this Mail.
Rickard �berg wrote:
> kdlitwak wrote:
> > I'm a little fuzzy on references and links and have a basic question
> > or two. In fact, I assume this is so basic that maybe anyone who
> > responds should communicate with me privately so as not to bother the
> > list with basic stuff.
>
> Nah, I don't think it's that basic.
>
> > Precisely how do a reference and a link differ semantically or
> > connotatively?
> >
> > A reference, if I understand it correctly, is just the name of the EJB
> > and its home interface, so that another bean at runtime can do a JNDI
> > lookup, right? I think that's what it is, but the language about
> > reference makes it sound like it is soothing more complicated.
Right.
>
> >
> > A link is supposed to be a way for an application assembler to provide a
> > way for one bean to find another bean. That sounds like a reference.
> > What's the difference?
> >
See below.
>
> > I assume that neither of these are an actual object reference to an
> > EB's home object, but just the name of the home interface so the caller
> > can do a JNDI lookup. Yes? Thanks.
Yes only for references.
>
>
> If I understand the question correctly, it's something like this:
> Both references and links (defined in this context by your above
> description) are JNDI names. A "reference" can be used through the
> standard JNDI lookup, i.e. the home is found by doing lookup(theRef).
That's what I think too.
> A
> "link" is an application internal link between beans that, as you note,
> the application assembler sets up, and is also a JNDI name but one would
> use the "java:comp/env" prefix to use it. I.e. if I have established a
> link named "Account" to some Account bean I would use
> lookup("java:comp/env/Account") to find the home of it.
>
I don't think so. The way a bean deployer uses to lookup the %ejb-link% (
deployment time) varies among application server implementations. The
application server can (but must not) use JNDI to resolve ejb-links.
1) the main difference is that a reference (ejb-ref-name) is a logical link to
an unknownk bean instance, when a link (ejb-link) refers to a concrete bean (in
the same descriptor or j2ee-unit).
2) The %ejb-link% tag is a matter of application assembler and bean deployer.
It will change allong the assemby process of an application, one or many times.
The %ejb-ref-name% can't be changed, because it is hardcoded in the bean.
>
> Syntactically they're just two different ways of doing lookup.
> Semantically the link concept is much more practical as it is a much
> more "persistent" way of connecting one bean with another, since the
> names will always be the same regardless of the naming implementation.
> You can also have several beans using the same link *name*, but in
> different beans and also different applications the result will be
> different. The result of a link lookup is bean-local.
>From the bean provider point of view, there is only one way to lookup a
dependency. The provider must use the context.lookup(%ejb-ref-name%). The
provider doesn't deal with %ejb-link% in the bean code.
Regards.
Francis.
===========================================================================
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".