Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why need setEntityContext in Entity Bean???

 
Bidyut Padhi
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
can any one give a little bit discription about
Why we need a setEntityContext() in Entity bean because it is independent of state?
Bidyut
 
Kartik Shah
Ranch Hand
Posts: 102
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
setEntityContext is the first method called after a bean instance is created.
It set the EntityContext of the bean
It provides information about the client that is using the bean. Alongwith providing this it also provides the instance with acccess to its own EJB home and EJB object.
 
Amanda Waite
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bidyut,
Entity beans represent persistent data from a data store and therefore when activated, they do have state. The state being the data that they represent. But state really has nothing to do with EntityContext. Through the EntityContext the bean can gain knowledge of; the EJB Object that it is associated with, it's Primary Key and it's environment.
Amanda
 
Bidyut Padhi
Ranch Hand
Posts: 121
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks
Amanda
I got the answer .
regards
Bidyut
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic