Its a fact that statefull session beans cannot be passivated while in a transaction while an enity bean can. Can any one tell me why this is not allowed?
I tried to search on almost all java forums but didn't find answer anywhere.
However, my point of view is that there may be some performance issues here.. like before passivation , the statefull session beans needs to close the open connections and re-aquire them when it is activated..
SCJP 1.4 : 91%
SCWCD 1.4 : 95%
SCBCD 1.3 : 95%
SCJP 6 Upgrade : 95%
Next SCBCD 1.5
Man is not finished when he is defeated. He is finished when he quits.
I think one issue in passivating a stateful session bean is that since it is associated with a single client, the state should be maintained across method calls.In case of an open transaction spanning multiple methods if the bean instance would have been passivated then there would be unnecessary overhead of restoring the state between method calls. In case of entity beans since they are not associated with a single client passivating an instance in a transaction would not be a problem.On a method call, if the previous instance has been passivated, the container can associate a new bean instance and load it with the data
Joined: Nov 13, 2005
can you just give some explanation with that one without using transaction.
I could be wrong, but here is what I think. Passivation of a session bean does not guarentee to repopulate the transient fields with their original values. So, think what might happen if you passivate a bean in the middle of a transaction? The end result might not be what you wanted.
Whereas in an entity bean, the container can synchronize the bean with the database anytime (using ejbLoad and ejbStore), so passivation would not be a problem.
MCSD, SCJP, SCWCD, SCBCD, SCJD (in progress - URLybird 1.2.1)
Joined: Jul 10, 2006
HI Cheenu I didn't get your question.What do you mean by without transation?
Joined: Nov 13, 2005
i just asked your explanation compared with: session beans with transaction session beans without transaction.
restoring the state between method calls
is it not required for session beans without transaction. i am not understanding this.