users@glassfish.java.net

Re: 2 ejb with the same local interface

From: Felipe Gaścho <fgaucho_at_gmail.com>
Date: Wed, 20 Jan 2010 16:16:56 +0100

it works with generics too ??

* I tried with generics and the server claims disambiguation.. if I
can use it with generics, it will remove tons of empty classes from my
project :)

On Wed, Jan 20, 2010 at 4:15 PM, <glassfish_at_javadesktop.org> wrote:
> This should work.  Any number of EJB components can implement the same interface.   If the interface is FooLocal, you would have :
>
> @Stateless
> public class ABean implements FooLocal { ... }
>
> and
>
> @Stateless
> public class BBean implements FooLocal { ... }
>
> ABean's ejb-name is "ABean".   BBean's ejb-name is "BBean".
>
> To acquire an EJB reference to a bean that implements FooLocal, in addition to specifying the type as FooLocal, you'll need to disambiguate the ejb-name.
>
> @EJB(beanName="ABean")
> public FooLocal fooLocalRef;
>
> or
>
> @EJB(beanName="BBean")
> public FooLocal fooLocalRef;
>
> Is this equivalent to what you tried?  If so, what exact error did you receive?
> [Message sent by forum member 'ksak' (kenneth.saks_at_sun.com)]
>
> http://forums.java.net/jive/thread.jspa?messageID=381976
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_glassfish.dev.java.net
> For additional commands, e-mail: users-help_at_glassfish.dev.java.net
>
>



-- 
------------------------------------------
   Felipe Gaścho
   10+ Java Programmer
   CEJUG Senior Advisor