• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Jeanne Boyarsky
  • Junilu Lacar
  • Henry Wong
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Frits Walraven
  • Tim Holloway
  • Carey Brown
Bartenders:
  • Piet Souris
  • salvin francis
  • fred rosenberger

Big doubt! Spec Page 361 -- IllegalStateException for Supports attribute.

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I read Spec page 361: The Container must throw the java.lang.IllegalStateException if the EJBContext.setRollbackOnly() method is invoked from a business method executing with the Supports, NotSupported, or Never transaction attribute.

Why there's exception for Supports Attribute? I understand, there's no transaction context for 'never' attribute, and unspecified transaction context for 'NotSupported' attribute, but method with 'Supports' attribute can have a valid transaction context (as long as the invoking method -- which invokes this 'Supports' attribute method -- has a valid transaction context, the 'Supports' attribute method will use this transaction context, so, the setRollbackOnly() can be invoked --- Why still IllegalStateException? Unless the invoking method has no valid transaction context, then the IllegalStateException should be thrown

Wait for you guys' suggestion.

Hai
 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hai, the thing with Supports is that you just don't know if you are running in a transaction or not. Look at page 499 of HFEJB. Any CMT method marked NotSupported, Never or Support runs in an unspecified transaction context. If there's no tx ctx there's no calling EJBContext.setRollbackOnly(), if you do you get a big fat IlegalStateException.

When are you taking the exam BTW? I'm gonna start doing mock exams now (haven't done one yet!) and take the exam in a couple of weeks maybe ...
 
It was the best of times. It was the worst of times. It was a tiny ad.
Devious Experiments for a Truly Passive Greenhouse!
https://www.kickstarter.com/projects/paulwheaton/greenhouse-1
    Bookmark Topic Watch Topic
  • New Topic