• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
rutuparna lastname
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
May I know which to use when ?
 
Frits Walraven
Creator of Enthuware JWS+ V6
Saloon Keeper
Posts: 2791
181
Android Chrome Eclipse IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!