Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring Transaction Support

 
Cheung Chau
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I believe Spring framework support more than just database tranaction. However, it is hard to find an example not including database transaction. Can anyone here give me a pointer on how to find such a tutorial. Thank you

-CCC
 
Mark Secrist
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might start here:
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/transaction.html#transaction-application-server-integration

The basic idea behind Spring Transaction support is to offer consistency in how you apply transactional behavior to your apps. That means you basically configure the appropriate transaction manager (or look it up using JNDI). Once configured, the @Transactional annotation should work the same.

If you are talking about invoking XA type behavior, I don't know of any examples specifically for that. However, also check out:
http://www.javaworld.com/javaworld/jw-01-2009/jw-01-spring-transactions.html

 
Cheung Chau
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mark,

Thank you for your reply. Believe it or not I give up searching two sections before that section (10.8) - around section 10.5 and 10.6, where I draw the conclusion that all the solid example will be about database. I also read 'Spring in Action' 3rd ed chapter 6 once - there is no complete example. You actually almost summarized the chapter with your comment

I am looking for and end-to-end tutorial - something that start with POJO class and end with a main class or JUnit test case that execute action in the POJO class or rollback if error. I know that may not exist or require me learning spec like JTA or technology like JBoss AS.

But can you give me some more pointer where to start. Anyway, thank you so much for your time.

-CCC
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But the point is, it doesn't matter. Databases or not, JTA or not, JBoss App Server or not, the way you do Transactions in Spring is always the same.

declare a transaction manager, then annotated your methods or class with @Transactional that you want to be transactional.

Mark
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic