• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

EntityContext

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In the Entity bean why the entity context variable should be declared as protected.
 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
The purpose of having the context variable is to get an access to the container-provided runtime context. That enables the bean instance to make a callback method call to the container that instantiated it.
Definitely , you won't like the context object (which is very vital to the bean for getting the information regarding it's runtime env) to be modified by some other class , in which case you may get a wrong info about the context under which the bean is running.
That is the reason why it is not made public. Note that the container doesn't modify the context variable. It only calls the setEntityContext() and unsetEntityContext() and it is the responsibility of the bean developer to store the context in a variale , so that it can be accessed later.
Regards,
Ashoke Bhowmick

Originally posted by R Krishnan:
In the Entity bean why the entity context variable should be declared as protected.

 
R Krishnan
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Since only the associated bean instance and the container access it, i expected it to be private.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Actually, the subclass for the bean generated at deploytime will probably have to access it directly too. That�s probably the reason it�s protected and not private.
 
I knew that guy would be trouble! Thanks tiny ad!
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic