This week's book giveaway is in the Java 8 forum.
We're giving away four copies of Java 8 in Action and have Raoul-Gabriel Urma, Mario Fusco, and Alan Mycroft on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Remove method and rollback 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 "Remove method and rollback " Watch "Remove method and rollback " New topic
Author

Remove method and rollback

Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
Using glassfish appserver, if a remove method is called on an EJB 3 SFSB within a transaction,
the transaction is marked for rollback; no exception is thrown.

Is this behavoir specified in the spec or is it special to glassfish ?

At least this behavoir is in contrast to the specification for EJB 2.1 beans (see core spec 4.4.4, page 82):
If a session bean instance is participating in a transaction, it is an error for a client to invoke the
remove method on the session object's home or component interface object. The container must detect
such an attempt and throw the javax.ejb.RemoveException to the client. The container should not mark
the client's transaction for rollback, thus allowing the client to recover.


SCJP 5 (98%) - SCBCD 5 (98%)
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
yes, it is defined in specification.

there is annotation @Remove


SCJP 1.4, SCWCD 5, SCBCD 5, OCPJWSD 5,SCEA-1, Started Assignment Part 2
My blog- http://rkydesigns.blogspot.com
Ralph Jaus
Ranch Hand

Joined: Apr 27, 2008
Posts: 342
Hi Amandeep

thanks for your answer. I was looking through the core spec and found the following (4.4 on page 76):
When the client calls a business method of the bean that has been designated as a
Remove method, or a remove method on the home or component interface, the container
invokes PreDestroy lifecycle callback interceptor method(s) (if any) for the bean instance
after the Remove method completes. This ends the life of the session bean instance.

But there is no hint that the transaction is marked for rollback. Do you know a reference
thereof in the spec ?
Amandeep Singh
Ranch Hand

Joined: Jul 17, 2008
Posts: 844
Ralph Jaus wrote:Hi Amandeep

thanks for your answer. I was looking through the core spec and found the following (4.4 on page 76):
When the client calls a business method of the bean that has been designated as a
Remove method, or a remove method on the home or component interface, the container
invokes PreDestroy lifecycle callback interceptor method(s) (if any) for the bean instance
after the Remove method completes. This ends the life of the session bean instance.

But there is no hint that the transaction is marked for rollback. Do you know a reference
thereof in the spec ?


no i don't know.

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Remove method and rollback
 
Similar Threads
Remove methods in component or home interface
java.rmi.RemoteException
Stateful Beans / Passivation / Extended Persistence
Exceptions
Transactions & Exception doubt