• 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

question on activation/passivation

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Guys,

I know the activation and passivation is bit different in entity bean and session bean. But still i have following doubts because of comparision.

1) ejbActivate/ejbPassivate method run in 'unspecified transaction context' both in entity bean as well as stateful session bean. But, it is possible to access 'other enterprise beans' and 'resource managers' in Stateful Session bean's ejbActivate/ejbPassivate method but NOT in Entity bean's ejbActivate/ejbPassivate method. Why?

2) In stateful session bean's ejbActivate/ejbPassivate method, we can access client's security info but, not in entity bean's ejbActivate/ejbPassivate method. Why?

Somebody please answer.

Thanks,
Prashant
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prasanth,
Thats an interesting question. I looked in to Spec, but i did not get the clear answer to that.

As i understood..
The Basic rule for ResourceManager access and Other Enterprise Bean acess is that the method(calling method) should be called atleast in a Transactional Context or it should have availability of the Security Context.

Wording from Spec
"
Accessing resource managers and enterprise beans is disallowed in the session bean methods
for which the container does not have a meaningful transaction context or client security context.
"

The steps what a container might be doing for Enity Beans is

1. Bean(Enity) is in pooled state
2. Client calls a Business method.
3. Container picks an instance from pool
4. Container sets the PrimaryKey
5. Call ejbActivate() without any transactional context.
(At this point the bean instance is not yet identified with client.)
6. Container passes the Security context to the instance via EJBObject.
(Now the bean instance is identified with the client)
7. Call ejbLoad() with in the transactional context of the invoked business method.

Vijay.
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Vijay, thanks for ur time.

1) According to spec, if there is a meaningful transaction context or client security context, bean can access ResourceManager and Other Enterprise Bean.So, since session beans have security context in ejbActivate/ejbPassivate methods, it can access the ResourceManager and Other Enterprise Bean. So this is fine.

2) I still dont understand this. Why security context is passed to ejbActivate/ejbPassivate methods ONLY in stateful session bean but not in ejbActivate/ejbPassivate methods of entity beans?

Thanks,
Prashant
 
Prashant Neginahal
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
other experts please answer.
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Prahant,

Good question. For stateful when you creating, you have identity(Client who calling the create method on home). So once you have security identity until the bean destory the identity has been kept by the container. So that security identity is available in ejbPassivate and ejbActivate.

But in entity bean,

As per our previous expert statement, after ejbActivate only we have security info.Because after the ejbActivate only container assigning a EJBObject, then only our business call delegate(this time only container assign a client info to this entitybean instance).

Simmilarlly,when container decided to call ejbPassivate on a entity instance means further business calls might not processed by this instance. So that client informations are removed from instance in entity bean. So that we don't have security info in ejbPassivate.

Regards
Kasimurugan R.
 
Surfs up space ponies, I'm making gravy without this lumpy, tiny ad:
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic