On Jul 6, 2009, at 10:44 AM, Dieter De Meyer wrote:
> Kenneth,
>
> This may seem like a stupid question but how do we go about creating
> the Local to work with ?
> Just call create() on the LocalHome ?
Exactly.
>
> Kind Regards,
> Dieter.
>
> On Mon, Jul 6, 2009 at 4:20 PM, Kenneth Saks <Kenneth.Saks_at_sun.com>
> wrote:
>
> On Jul 6, 2009, at 10:12 AM, Dieter De Meyer wrote:
>
>> Hi Kenneth,
>>
>> Thanks for your reply.
>> I have already tried different versions of what you suggested.
>> Do you mean that the following should result in the correct
>> generation of the ejb-jar.xml ?
>>
>> @EJB(name = “ejb/local/BarBean”, beanInterface = BarLocalHome.class)
>> private BarLocal bar;
>
> Sorry, forgot to mention you need to change the type of the field as
> well. In fact, you don't
> need to set the beanInterface attribute in the field case since it's
> just inferred from the type
> of the field.
>
> @EJB(name="ejb/local/BarBean")
> private BarLocalHome barLocalHome;
>
> If you're accessing the EJB 2.x client view, the client still needs
> to deal with the LocalHome
> as the initial object, then use that to create the Local.
>
>>
>> Kind regards,
>> Dieter.
>>
>> On Mon, Jul 6, 2009 at 4:06 PM, Kenneth Saks <Kenneth.Saks_at_sun.com>
>> wrote:
>>
>> On Jul 6, 2009, at 9:48 AM, Dieter De Meyer wrote:
>>
>>> Hello,
>>>
>>> At our project, we are trying to access an EJB 2 Session Bean from
>>> within an EJB3 Session Bean with the @EJB injection.
>>> Following the EJB FAQ on Java.Net, we configured our EJB3 as
>>> followed:
>>>
>>> @Stateless
>>> public class Foo implements fooService {
>>> @EJB(name = “ejb/local/BarBean”, beanInterface =
>>> BarLocal.class)
>>> private BarLocal bar;
>>> }
>>>
>>> The generated ejb-jar.xml contains the following code:
>>>
>>> <ejb-ref >
>>> <ejb-ref-name>ejb/local/ BarBean </ejb-ref-name>
>>> <ejb-ref-type>Session</ejb-ref-type>
>>> <remote>example.BarLocal</remote>
>>> </ejb- ref>
>>>
>>> Following the FAQ, I would expect the following:
>>>
>>> <ejb-local-ref>
>>> <ejb-ref-name>ejb/local/ BarBean </ejb-ref-name>
>>> <ejb-ref-type>Session</ejb-ref-type>
>>> <local>example.BarLocal </local>
>>> </ejb- local-ref>
>>>
>>> Can someone tell me what we are doing wrong ?
>>
>> Hi Dieter,
>>
>> If you're accessing an EJB that was written to the EJB 2.x API, the
>> beanInterface should be set
>> to the Home or LocalHome interface of the target EJB. In that
>> case, the corresponding Remote or Local
>> 2.x interface is derived from the Home/LocalHome.
>>
>> @EJB(name="ejb/local/BarBean", beanInterface=BarLocalHome.class)
>>
>> That should result in something like this :
>>
>> <ejb-local-ref>
>> <ejb-ref-name>ejb/local/BarBean</ejb-ref-name>
>> <ejb-ref-type>Session</ejb-ref-type>
>> <local-home>example.BarLocalHome</local-home>
>> <local>example.BarLocal</local>
>> ...
>> </ejb-local-ref>
>>
>>
>>>
>>> Kind regards,
>>>
>>> Dieter De Meyer.
>>
>>
>>
>>
>> --
>> Mvg,
>>
>> Dieter De Meyer.
>
>
>
>
> --
> Mvg,
>
> Dieter De Meyer.