File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes transaction gets rolled back when returning from a method of a session bean Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "transaction gets rolled back when returning from a method of a session bean" Watch "transaction gets rolled back when returning from a method of a session bean" New topic
Author

transaction gets rolled back when returning from a method of a session bean

Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
Hi all,

I have a Stateful session bean with three method preProcess, process and postProcess. the postProcess method marked with @Remove
these three methods are called in one method in a stateless session bean. After calling the postProcess the transaction is maked to rollback. I put a bunch of System.out to pring out getRollbackOnly() of the session context and I am sure no exception occured. At the point of returning from postProcess the log shows the getRollbackOnly() is false but in callee method right after this method getRollbackOnly() is true!!!

Does anybody know what the problem is?

@Remove
public void postProcess() {
....
logger.debug(sc.getRollbackOnly()); //prints out false
}


//in stateless SB
public void someMethod() {

mystateful.preProcess();
mystateful.process();
mystateful.postProcess();
logger.debug(sc.getRollbackOnly()); //prints out true!!!

}



Regards, Mohammad
my.blog | my.photoblog | Add your name to SCJP Wall Of Fame
Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
Hi
I've just removed the @Remove from the method and now it works fine but what happens for a stateful without a remove method? What was the problem?
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10051
    
163

Which application server are you using? The logs might contain more details as to what's going on.

[My Blog] [JavaRanch Journal]
Mohammad Norouzi
Ranch Hand

Joined: Jul 12, 2005
Posts: 71
Jaikiran Pai wrote:Which application server are you using? The logs might contain more details as to what's going on.


I am using Glassfish I'll try to post the log tomorrow
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: transaction gets rolled back when returning from a method of a session bean