• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

ejbActivate and EntityContext

 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi
Can anybody please explain me why entity bean's ejbActivate method can't do following on EntityContext
1. get security information about client.
2. force a transaction to rollback(CMT beans)
3. find out if the transaction has already been set to rollback(CMT beans)
4. get a transaction reference, and call methods on it (BMT beans only, so entities can't use this)
I guess ejbActivate method of entity bean is called by container when the bean is picked up from the pool to serve a client when it invokes the entity beans business method. So there is a client during ejbActivate.
Regards
Mini
 
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Mini,
Is this a cross-post? I seem to recall already answering it.
 
mini mehta
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Nathaniel Stoddard:
Mini,
Is this a cross-post? I seem to recall already answering it.


Hi Nathaniel
I posted it again in this forum because I didn't a satisfactory answer. Following is your answer :
" The answer to all your questions is no due to the fact that there is no client during ejbActivate. Therefore there is no transaction."

But Infact, that is not true because you can access bean's EJBObject and EJBHome from the ejbActivate method, which means that it can see the client.
Regards
mini
 
Nathaniel Stoddard
Ranch Hand
Posts: 1258
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just because you can get the home or component interface doesn't mean there's a valid transactional context. They are separate things. Obviously you can get the home and component interface when you are in a valid context due to a client invoking a call. But, you do not have to be in a transaction to get home or component interface. In ejbActivate for example, there is no transactional context, but as you stated, you can still get the home and component interfaces.
 
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Nathaniel,
You post that we can get the context , from the context we can get the home and component . Then when will we get the transactional context (at the time of ejbActivation).
Thanks and regards
Anna Madhusudhanan
 
Ranch Hand
Posts: 1646
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Anna Madhusudhanan Natanagopalan:
Then when will we get the transactional context (at the time of ejbActivation).


Well, not at the time of activation. You have a valid transactional context only during the execution of a business method. ejbActivate is not a business method. That being said, I would assume you need a transactional context during ejbLoad, but that method again is not a business method.
I've never needed to do anything in ejbActivate, and honestly I cannot think of what you'd want to do there that you couldn't do inside a business method. Can you (or the OP) give us the problem you're trying to address? Maybe there's another way to solve it.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic