• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Liutauras Vilda
  • Henry Wong
  • Devaka Cooray
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Al Hobbs
  • Carey Brown
Bartenders:
  • Piet Souris
  • Mikalai Zaikin
  • Himai Minh

HF exam Question on Transacton

 
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
I am new to EJB. Can any body help me?
If a session beans business method invokes, EJBContext.setRollBackOnly(),which transaction attribute settings can cause the container to throw the java.lang.IllegalStateException?

1. NotSupported
2. Required
3. Supports
4. RequireNew
5. Mandatory
6. Never.


Answers are NotSupported, Supports and Never.

Can any body help why these are the answers only?
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Container can Rollback only when business method is in transaction, but when transaction does not exist and trying to Rollback. It will always give java.lang.IllegalStateException.
Because NotSupported , Supports, Never only these three transaction attribute allows a method call without existing a transaction.
 
Ranch Hand
Posts: 351
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Methods like setRollbackOnly or getRollbackOnly throw IllegalStateException if there is no Transaction Context. Supports, NotSoppurted and Never transaction attributes means there is not (or might not - for supports) a Transaction Context.

Generally method which should be called in a transaction context throw IllegalStateException when called from a method not executing in a transaction. This is the ground for the answers given

Regards,
Leena
[ March 11, 2005: Message edited by: Leena Diwan ]
 
kishore chitturi
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
Thank You for giving reply
regards
kishore
reply
    Bookmark Topic Watch Topic
  • New Topic