Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Transaction timeout for EJBs? If so, you can do that using @org.jboss.ejb3.annotation.TransactionTimeout on the individual beans.
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So it looks like you want to set the transaciton timeout controlled by the Spring transaction manager?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic