jsr345-experts@ejb-spec.java.net

[jsr345-experts] EJB bean not being abstract

From: Antonio Goncalves <antonio.goncalves_at_gmail.com>
Date: Mon, 5 Mar 2012 15:54:04 +0100

Hi all,

Since the beginning (well, as far as I remember) EJBs bean cannot be
abstract :

*4.9.2 - Session Bean Class*
*The following are the requirements for the session bean class:*

   - *The class must be defined as public, must not be final, and must not
   be abstract. The class must be a top level class.*


That's fine, I've always live with that. But at the moment I'm working on
migrating a Spring application to Java EE 6. This project has very clever
abstract Spring services and abstract Spring repositorie (DAOs). All
services inherit from these ones. One guy (who doesn't know much EJBs)
naturally turned them into abstract EJBs (abstract classes annotated with
@Stateless). I was amazed to see that it was working on JBoss (but not on
GlassFish).

When I looked at this code, it made me wonder : why not having abstract
EJBs ? if it works on JBoss why not making it work everywhere... and get
closer to an OO approach ?

Just wondering....

Antonio