aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Operations Allowed in the Methods of a MDB Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Operations Allowed in the Methods of a MDB" Watch "Operations Allowed in the Methods of a MDB" New topic
Author

Operations Allowed in the Methods of a MDB

ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Hi

Is invoking getEJBObject or getEJBLocalObject allowed in message-driven bean methods?

I looked at the EJB specifications and it doesn't mention this although it does mention that "Invoking getEJBHome or getEJBLocalHome is disallowed in message-driven bean methods".

Thanks

-- Ravi


SCJP, SCJD, SCWCD, SCBCD, SCEA
Daniel Rhoades
Ranch Hand

Joined: Jun 30, 2004
Posts: 186
Since you talk to MDB through the JMS, you never get a reference to a bean or an EJBObject.

So MDB don't have homes, infact you don't even write a home or component interface, only the bean class


Drinking more tea is the key...
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Hi

So what happens if getEJBObject or getEJBLocalObject is invoked in message-driven bean methods. Does it throw java.lang.IllegalStateException?

Thanks

-- Ravi
[ March 25, 2005: Message edited by: Ravindra Janapareddy ]
amol deshpande
Ranch Hand

Joined: Sep 05, 2003
Posts: 162
You are right ravi,
Its java.lang.IllegalStateException....will kill bean, Tx rollback and log it.(i mean bean instance....i know u know..but..)
amol.
ravi janap
Ranch Hand

Joined: Nov 04, 2000
Posts: 389
Hi

EntityContext provides getEJBObject, getEJBLocalObject and getPrimaryKey methods apart from the methods inhertited from EJBContext.

SessionContext provides getEJBObject and getEJBLocalObject methods apart from the methods inhertited from EJBContext.

Whereas MessageDrivenContext doesn't provide any methods apart from the methods inhertited from EJBContext.

That explains the answer.

Thanks

-- Ravi
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Operations Allowed in the Methods of a MDB