The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes MDB's superclass as MDB - allowed or not? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "MDB Watch "MDB New topic

MDB's superclass as MDB - allowed or not?

Piotr Nowicki
Ranch Hand

Joined: Jul 13, 2010
Posts: 610

Howdy Ranchers!

Quick question - can a MDB have a superclass which is another MDB? I'm a bit confused after reading this:

EJB 3.1 spec, p. 151, 5.6.2 wrote:A message-driven bean class must not have a superclass that is itself a message-driven bean class.

EJB 3.1 spec, p. 151, 5.6.3 wrote:A message-driven bean class is permitted to have superclasses that are themselves message-driven bean classes.

So... can or can not? :-)

Thanks in advance!


OCP Java SE 6 Programmer, OCM Java SE 6 Developer, OCE Java EE 6 JSPSD, OCE Java EE 6 EJBD, OCE Java EE 6 JPAD, Spring 3.0 Core Professional.
Lucas Smith
Ranch Hand

Joined: Apr 20, 2009
Posts: 804

Can anyone clear this out? This is a kind of inconsistency.

BLOG: http://leakfromjavaheap.blogspot.com
Dieter Quickfend

Joined: Aug 06, 2010
Posts: 510

Just wanted to bring this back from the dead as I've just come across this inconsistency in the spec, and would like to have it cleared out.

So, can an MDB have a superclass that is also an MDB... or not?

Oracle Certified Professional: Java SE 6 Programmer && Oracle Certified Expert: (JEE 6 Web Component Developer && JEE 6 EJB Developer)
Frits Walraven
Creator of Enthuware JWS+ V6

Joined: Apr 07, 2010
Posts: 1636

Hi Dieter,

I have concluded that it is possible (with the same explanation as is used the Session Beans): "the use of message-driven bean classes as superclasses merely represents a convenient use of implementation inheritance, but does not have component inheritance semantics."

in other words:
"A listener interface exposed by a particular message driven bean is not inherited by a subclass"

Message Driven Bean A exposes the message listener interface Echo and Message Driven Bean B exposes the message listener interface Talk, but not Echo (unless explicitly put as an implementer).

I guess this is a theoretical discussion as I can not think of any practical solution where you would need something like this.

Dieter Quickfend

Joined: Aug 06, 2010
Posts: 510

So it's permitted - thanks Frits!
I agree. Here's the link: http://aspose.com/file-tools
subject: MDB's superclass as MDB - allowed or not?
Similar Threads
MOM question
MDB and its strange inheritance
can MDB used for Topic listening?
Mock Question about Transactions
multi-threading from web service