Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Pg 487 on HFEJB

 
Ankit Doshi
Ranch Hand
Posts: 222
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
On Page 487, it's written that :

A bean that calls setRollbackOnly() must be in a transaction.

The questions are:

- What would happen if a bean calling setRollbackOnly() is NOT in a transaction? Does it throw some exception? If yes which one?
- Does the above type of constraint applies to the other methods as well? (getRollbackOnly(), getStatus(), ...)?
 
Srinivas Bolloju
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It throws IllegalStateException.

These methods are available in EJBContext class.
some of the methods works in certain type of beans and also depends on the status of the bean (i.e whether the bean is in trasaction or not).

If the criteria to call that method is not met then it throws IllegalStateException
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic