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
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
Joined: May 29, 2003
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.
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
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.