This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Spring and the fly likes Is it possible to set the transaction timeout at the application level Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Is it possible to set the transaction timeout at the application level" Watch "Is it possible to set the transaction timeout at the application level" New topic
Author

Is it possible to set the transaction timeout at the application level

Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Hi,

I'm using JBoss 7.1.1. on Mac 10.7.5. While I was able to find how to set the transaction timeout on a global basis, is it possible to put some kind of configuration into my WAR file to tell JBoss I want a specific transaction timeout for my application? I'm using Spring 3.1.1.RELEASE and Hibernate 4.1.0.Final.

Thanks, - Dave
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

Transaction timeout for EJBs? If so, you can do that using @org.jboss.ejb3.annotation.TransactionTimeout on the individual beans.

[My Blog] [JavaRanch Journal]
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Oh, no, I'm creating a web application (WAR) and am currently using Spring "@Transactional" annotation to declare which of my service methods (service class is declared with Spring's @Service annotation) I want treated as transactions. Here's how i declare my transaction manager in my spring application context ...



and here's my persistence.xml file ...

Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9962
    
163

So it looks like you want to set the transaciton timeout controlled by the Spring transaction manager?
Dave Alvarado
Ranch Hand

Joined: Jul 02, 2008
Posts: 436
Yeah, I think so. I tried setting the timeout attribute on the "@Transactional" method of my service class ...



but this doesn't work (I set it to a low value to test it stuff would actually time out, but it didn't).
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

So for 20 seconds. And you say a call to that method did not timeout and rollback?

You can also put @Transactional on top of the class and all the public interface methods then all get those settings and is transactional.

Did you also use

<tx:annotation-driven/> in your xml config file?

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Is it possible to set the transaction timeout at the application level
 
Similar Threads
Transaction Rolledback exception is not throwing correctly in JBOSS EAP 5.1.2
Transactions aborted
Transaction timeout
EJB Transaction Timeout
setTransactionTimeout in CMP