File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Spring transaction

 
ravisha andar
Ranch Hand
Posts: 55
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

What is the exact advantage of using Spring transaction.

Can anybody share a sample code for implementing it

Thanks
 
Mark Spritzler
ranger
Sheriff
Posts: 17276
6
IntelliJ IDE Mac Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ravisha andar wrote:Hi All,

What is the exact advantage of using Spring transaction.

Can anybody share a sample code for implementing it

Thanks


Do you understand the purposes of a Transaction in Java code? That is all that Spring is doing, is managing and handling a transaction for you. Starting one one, committing or rolling back for you based on success or a RuntimeException being thrown.

Code looks like this

@Transactional
public Something doWork() {
}

and definining a bean for trensactionManager and <tx:annotation-driven/>

Mark
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic