• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Possible to run an EJB3 timer without transaction?

 
Steve Sinai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Is there a way to run an EJB3 timer without it being inside a transaction?

Sometimes the methods run by the timer throw exceptions, and I'd like to be able to update a database with a failed flag if that happens. But the EJBTransactionRolledbackException that gets thrown prevents me from doing this.

Thanks.
 
Meiyappan Kannappa
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I hope you can disable the transaction by setting the transaction attribute to Never or Not supported . But I havent tried of this scenario.
 
Steve Sinai
Greenhorn
Posts: 25
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I was able to solve the problem by not throwing Timer exceptions up to a common exception handling method. Instead I caught them and dealt with them in the method in which they were caught.

It was turning out that if I threw an exception up the method chain, EJB would automatically embed it in some kind of transaction exception, which meant I couldn't write something to the database notifying people that an exception had occurred. If I didn't throw the exception, then there was no transaction exception involved.
 
William P O'Sullivan
Ranch Hand
Posts: 859
IBM DB2 Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for sharing Steve, interesting...

WP
 
Destiny's powerful hand has made the bed of my future. And this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic