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.