Win a copy of Java 9 Revealed this week in the Features new in Java 9 forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
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: 2921
205
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
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!