This week's giveaway is in the Spring forum.
We're giving away four copies of REST with Spring (video course) and have Eugen Paraschiv on-line!
See this thread for details.
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Exception ques. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Exception ques." Watch "Exception ques." New topic

Exception ques.

Tontang Bei
Ranch Hand

Joined: Oct 21, 2006
Posts: 130
What will happen if I call getRollbackOnly() or SetRollbackOnly() of EJBContext in methods not marked with Required, RequiresNew or Mandatory? will I get an exception?
Deepak Bala

Joined: Feb 24, 2006
Posts: 6662

Why would you get an exception ? You would have a transaction and CMT and you can setrollbackonly from the context. Its legal. If you use the userTransaction however, thats another question.

SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Malan Subramanian

Joined: Jul 09, 2005
Posts: 13
Hmm... Assuming that am calling setRollbackOnly() in a CMT bean whose business method has a transaction attribute, NotSupported or Never, then an exception should definitely be thrown coz there is no active transaction available for rollback.
I agree. Here's the link:
subject: Exception ques.
It's not a secret anymore!