users@glassfish.java.net

Re: Disambiguating two EJBs in an .ear file

From: Marina Vatkina <marina.vatkina_at_oracle.com>
Date: Fri, 21 Jun 2013 11:15:46 -0700

On 6/21/13 10:52 AM, Laird Nelson wrote:
> On Fri, Jun 21, 2013 at 10:31 AM, Marina Vatkina
> <marina.vatkina_at_oracle.com <mailto:marina.vatkina_at_oracle.com>> wrote:
>
> <ejb-local-ref> defines a reference to another EJB that will be
> looked up.
>
>
> Ah, OK, but does not...does not /per se/ cause the injection to
> happen; for that I need to specify the <injection-target-*> stuff. Right?
>
> Must I also specify the <ejb-ref-type>, if it is already implicitly
> declared by my use of annotations? I would think not.

It's optional, and the spec doesn't require it "the target enterprise
bean must be of the type indicated in the ejb-ref-type element, if present".

>
> Revised attempt:
>
> <ejb-name>XBean</ejb-name>
> <ejb-local-ref>
> <ejb-ref-name>XBean/y</ejb-ref-name>

It should be >y<
> <ejb-link>YBean</ejb-link>
> *<injection-target>*
> *<injection-target-class>foo.XBean</injection-target-class>*
> *<injection-target-name>y</injection-target-name>*
> * </injection-target>*
> </ejb-local-ref>
>
> Best,
> Laird
>
> --
> http://about.me/lairdnelson