wood burning stoves 2.0*
The moose likes EJB and other Java EE Technologies and the fly likes TransactionAttribute - what's the right setting Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "TransactionAttribute - what Watch "TransactionAttribute - what New topic
Author

TransactionAttribute - what's the right setting

biking fool
Greenhorn

Joined: Oct 18, 2013
Posts: 1
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
*/
@Stateless
@TransactionManagement(TransactionManagementType.CONTAINER)
@TransactionAttribute(TransactionAttributeType.NOT_SUPPORTED)
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
Ranch Hand

Joined: Aug 06, 2010
Posts: 359
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.


Oracle Certified Professional: Java SE 6 Programmer
Oracle Certified Expert: Java EE 6 Web Component Developer
Oracle Certified Expert: Java EE 6 Enterprise JavaBeans Developer
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: TransactionAttribute - what's the right setting
 
Similar Threads
Marking data as read
Detecting multiple browser windows
Reading password protected Excel spreadsheet
Setting Request - Response Time Out Programatically
oracle stored proc for tree