Win a copy of Fixing your Scrum this week in the Agile forum!
  • 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
  • Ron McLeod
  • Paul Clapham
  • Rob Spoor
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Holloway
  • Piet Souris
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Frits Walraven
  • 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
 
Well THAT's new! Comfort me, reliable tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic