Win a copy of The Business Blockchain this week in the Cloud forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why a SFSB cannot be passivated in a transaction?

 
AmitKumar Jain
Ranch Hand
Posts: 95
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ranchers!

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..

Regards,
Amit
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its a good question.
waiting for some great explanation from someone.
 
paresh vernekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
can you just give some explanation with that one without using transaction.
 
Richard Green
Ranch Hand
Posts: 536
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
paresh vernekar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI Cheenu I didn't get your question.What do you mean by without transation?
 
cheenu Dev
Ranch Hand
Posts: 276
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Nitin Parashar
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Amit,

This is not an answer to your question, but can you given an example of a scenario where you would want a SFSB to be passivated while in transaction.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic