aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Why a SFSB cannot be passivated in a transaction? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Why a SFSB cannot be passivated in a transaction?" Watch "Why a SFSB cannot be passivated in a transaction?" New topic
Author

Why a SFSB cannot be passivated in a transaction?

AmitKumar Jain
Ranch Hand

Joined: Jun 13, 2005
Posts: 95
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


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.
cheenu Dev
Ranch Hand

Joined: Nov 13, 2005
Posts: 276
its a good question.
waiting for some great explanation from someone.


cheenujunk@gmail.com
paresh vernekar
Ranch Hand

Joined: Jul 10, 2006
Posts: 52
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

Joined: Nov 13, 2005
Posts: 276
can you just give some explanation with that one without using transaction.
Richard Green
Ranch Hand

Joined: Aug 25, 2005
Posts: 536
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)
paresh vernekar
Ranch Hand

Joined: Jul 10, 2006
Posts: 52
HI Cheenu I didn't get your question.What do you mean by without transation?
cheenu Dev
Ranch Hand

Joined: Nov 13, 2005
Posts: 276
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

Joined: Jun 06, 2003
Posts: 52
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.


SCJP 1.4, SCWCD 1.4, SCBCD 1.3
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why a SFSB cannot be passivated in a transaction?
 
Similar Threads
Simple session bean question
Beta Mock Question - Session Bean Passivation
doubt in stateful session bean passivation
Confirmation About Transaction
Passivation of enity beans