• 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
  • paul wheaton
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
Bartenders:

System exception thrown inside a business method during a transaction

 
Bartender
Posts: 2453
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am reading chapter 13 Transaction Support of JSR 318. This specification does not say if the transaction will be rollback if a business method throws a system exception or runtime exception.

But it mentions this

an EJB marks a transaction for rollback to protect data integrity before throwing an application exception.



So, will the container rollback the transaction when an unexpected system / runtime exception occurs?
 
Creator of Enthuware JWS+ V6
Posts: 3412
320
Android Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Himai,

Did you take that phrase from this section of the specs?

13.3.4.2 javax.ejb.EJBContext.setRollbackOnly Method
An enterprise bean with container-managed transaction demarcation can use the setRollbackOnlymethod of its EJBContext object to mark the transaction such that the transaction can never commit. Typically, an enterprise bean marks a transaction for rollback to protect data integrity before throwing an application exception, if the application exception class has not been specified to automatically cause the container to rollback the transaction.


This section is talking about the usage of the setRollbackOnly() method, not about system exceptions.

Chapter 14 deals with exceptions, and you might want to read 14.2.2 System Exceptions to answer your question.

Regards,
Frits
 
passwords must contain 14 characters, a number, punctuation, a small bird, a bit of cheese and a tiny ad.
Clean our rivers and oceans from home
https://www.kickstarter.com/projects/paulwheaton/willow-feeders
reply
    Bookmark Topic Watch Topic
  • New Topic