Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

TransactionAttribute - what's the right setting  RSS feed

biking fool
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We have a process sometimes creates an email showing all zeros in the stats even though that's not truly what's on the database.

The process works like this
1. User selects a spreadsheet.
2. User hits the button to start the load/calculations and that timestamp is captured. (start_tsp)
3. Load occurs
4. Calculations occur
5. Timestamp is captured (end_tsp)
6. Email details are compiled by querying the tables loaded. Criteria for those queries is the user's lid and maint timestamp between the start_tsp and end_tsp)
7. Email is sent

Everything works fine most of the time, but occasionally, the queries from step 6 return nothing.
I added logging to verify the queries have the correct lid and timestamps. Running the same query in SQL Nav afterwards shows rows for the lid between the timestamps.
This has happened only in our Production environment. We can't recreate it in Test or even make it happen consistantly in Prod. (We've had the user reload the same spreadsheet after getting the 0's and it'll work the second time.)

One of our tech guys suggested that the TransactionAttribute could be the problem. Here's how that's set:

* Session Bean implementation class NTBServiceImpl Must be marked not supported
* so that it does not timeout
public class NtbServiceImpl implements NtbService {

He's recommending it be changed to REQUIRED or REQUIRES_NEW. But, note that the comment is saying it's set to NOT_SUPPORTED so it won't timeout. Tech guy isn't sure what will happen then.
This process takes 1-2 minutes real time so timeout is a possibility.

Should I change the attribute? If so, to what?

Thanks for the help.

PS. I'm new to this transaction stuff, so please explain in '... for dummies' language.
Dieter Quickfend
Posts: 543
Java Netbeans IDE Redhat
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In JBoss, you can use the @TransactionTimeout annotation... If not, check your server documentation to change the Transaction Timeout on that specific method, or in general.

But not using a transaction to circumvent the timeout is not a good practice.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!