EJBean's member variables shared?
1 posts in topic
Flat View  Flat View

Posted By:   Martin_Voigt
Posted On:   Monday, April 29, 2002 06:36 AM

are member variables of an entity bean that are not public and no CMP fields shared among the multiple instances of this bean? a friend told me so, but that would mean they behave like static ones.
thanks in advance

Re: EJBean's member variables shared?

Posted By:   Bozidar_Dangubic  
Posted On:   Monday, April 29, 2002 12:31 PM

sure they are shared. entity EJB is truly shared meaning for a given entity bean identified by a prim key, any client accessing the bean is actually hitting the same EJB object. this is different from session beans where a session bean always services a single client at one time, stateful obviously since it is a client's extension on the server while stateless, even though they are pooled, actually service one client at any given time. therefore, an instance variable in an entity bean is shared between all clients for a given bean. but this is not static. if the variable was static, all client of all entity beans of the same type (with different prim keys) would share the same variable. if instance variable was not static, only clients accessing the same entity bean with one prim key would share that instance variable. hope I was clear enough in the explanation.
About | Sitemap | Contact