Win a copy of Design for the Mind this week in the Design forum!
  • 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
Pie
Posts: 2337
87
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