[cdi-dev] Session Bean business interface inheritance

Martin Kouba mkouba at redhat.com
Wed Jun 6 08:04:16 EDT 2012


Hi,

comments inline...

Martin

> Hi
> There's a bunch of small discrepancies like that between EJB and CDI. e.g GF-16186 <http://java.net/jira/browse/GLASSFISH-16186> I reported one year ago which ended up on WELD-921 <https://issues.jboss.org/browse/WELD-921>. And we also had isues with covariant methods on @Local interfaces in the past.

WELD-921 is definitely related and should be fixed asap.

>
> With CDI gradually percolating through all EE, one day or another - from EE7 I hope - EJB and CDI will have to behave the same way.

+100 :-)

>
> In the context of this WELD-1133 it would be preferable to align EJB on CDI, unless of course some important usecase gets harmed (but I don't see which). Else the spec clash will remain and in a few years users will keep wonrdering what we were thinking.

Further investigation showed up that the conflict is rather debatable or at least not so serious. The most important question is whether methods from inherited interface should be exposed as business methods through local client view of session bean. Not whether inherited interface is exposed as local view. I suppose they should. But sometimes it's a question of interpretation... :-(

>
> fm.
>
>
> On Tue, Jun 5, 2012 at 5:50 PM, Martin Kouba <mkouba at redhat.com <mailto:mkouba at redhat.com>> wrote:
>
>     Hi,
>
>     recently we had an issue with regard to Session Bean business interface inheritance when running CDI TCK 1.0.4.SP3 on GlassFish - see also WELD-1133 [1]. The following discussion revealed possible specification conflict (EJB 3.1 vs CDI 1.0). Pete Muir asked me to write some brief summary. So here it is :-)
>
>     The problem: it seems that session bean business interface inheritance is not allowed in EJB 3.1
>     (4.9.2.1 Session Bean Superclasses)
>
>     Let's assume this code:
>
>     @Local
>     interface Bar {}
>
>     @Local
>     interface Foo extends Bar {
>     }
>
>     @Stateless
>     class FooBean implements Foo {
>     }
>
>     According to the spec (EJB 3.1) the set of exposed client views of FooBean should only be Foo. Not Foo and Bar.
>
>     However the CDI spec defines bean types for a session bean in a following way: "The unrestricted set of bean types for a session bean contains all local interfaces of the bean and their superinterfaces" (3.2.2. Bean types of a session bean).
>
>     Note that some EJB implementations DO support this kind of inheritance out of the box (e.g. JBoss AS 7 EJB module).
>
>     Martin
>
>     [1]
>     https://issues.jboss.org/browse/WELD-1133
>
>     --
>     Martin Kouba
>     JBoss Quality Assurance Engineer
>     E-mail: mkouba at redhat.com <mailto:mkouba at redhat.com>
>     Web: www.cz.redhat.com <http://www.cz.redhat.com>
>     Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic
>     _______________________________________________
>     cdi-dev mailing list
>     cdi-dev at lists.jboss.org <mailto:cdi-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/cdi-dev
>
>


More information about the cdi-dev mailing list