aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Diffrence between @EJB and  SessionContext.getBusinessObject(InterfaceName.class) ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Diffrence between @EJB and  SessionContext.getBusinessObject(InterfaceName.class) ?" Watch "Diffrence between @EJB and  SessionContext.getBusinessObject(InterfaceName.class) ?" New topic
Author

Diffrence between @EJB and SessionContext.getBusinessObject(InterfaceName.class) ?

rutuparna lastname
Greenhorn

Joined: Aug 01, 2009
Posts: 4
May I know which to use when ?
Frits Walraven
Creator of Enthuware JWS+ V6
Bartender

Joined: Apr 07, 2010
Posts: 1715
    
  25

Hi Rutuparna

@EJB is used to inject an EJB in your (client) code.

SessionContext.getBusinessObject(InterfaceName.class) is used to get a reference to "your own" EJB (and pass it for instance to another EJB), as you can't use the "this" keyword.

Regards,
Frits
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Diffrence between @EJB and SessionContext.getBusinessObject(InterfaceName.class) ?