9944

What is a Transaction in Spring Framework?

<h3>Question</h3>

I have been reading about @EnableTransactionManagement and then @Transactional annotations which ensures that say if a transaction involves 3 DAO operations and the 3rd fails then the first 2 also rolls back. Also, it helps when concurrent threads are accessing the same method/class. However, I could not understand what exactly a Transaction is?

I have assumed from the numerous answers on StackOverflow and other places that it is an operation when data is manipulated in the Db from the Spring Boot application. Am I correct? I could not find any question on STF that asks this question.


<h3>Answer1:</h3>

Yes you are correct. See this answer for a good explanation What is a database transaction?.

From the Spring point of view, the @Transactional annotation will create an AOP point cut around your method. What this essentially does, is makes sure that any DB related queries that are executed within your method, are wrapped into a Transaction and executed as a single unit of work.

来源:https://stackoverflow.com/questions/60229066/what-is-a-transaction-in-spring-framework

Recommend

  • first child element of particular type
  • How to find the coverage of a library opened using dlopen()?
  • differences for creating set using set() or {}
  • Outer product in tensorflow
  • MSBuild / Visual Studio distributed builds
  • pan gesture issue, slight movement within UIButton detection
  • SQL Server - simple way to create pivot
  • Medical Values: 1 Super Exam Table or Lots of Exam Tables
  • Python script won't exec from php when specific library is used
  • How to access native iOS file system using Sencha touch 2 alone
  • How to catch crash without disturbing the normal crash flow
  • Error: Command failed: C:\\Windows\\system32\\cmd.exe /s /c “rm ./mean/package.json”
  • Is it possible to specify 16 colums to bootstrap 3
  • How to extract details from the xml files using java?
  • Redirecting the print output to a .txt file in Python
  • Unable to select a space or join an organization on run.pivotal.io
  • 3 transitions, pausetime between transitions
  • Python List of Tuples (Find value with key + check if exist)
  • Insert statement not working using execute(array()) of PDO Extension
  • Making query to find nearest multiple(Lat,Long) from the single(Lat,Long)
  • Get last 15 lines from a large file in SFTP with phpseclib [duplicate]
  • Ways of filling 10 places with number from [1..10] such that digit at ith place has value atmost 1 m
  • SyntaxError: expected expression, got '.'
  • Slick: How can I combine a SQL LIKE statement with a SQL IN statement
  • How to modify the way a ForeignKey field is rendered in a Django admin page to avoid browser crash?
  • C++11: Why rvalue reference parameter implicitly converted to lvalue
  • Connect to a local database from phpmyadmin with R
  • Autocomplete source from project settings
  • Java Collections.shuffle() weird behaviour [closed]
  • How to use AJAX to upload large CSV file? [closed]
  • How to specify generic type when the type is only known at runtime?
  • Change cell value based on cell color in google spreadsheet
  • How to integrate angular2-material (alpha 8.2) with angular2-Quickstart app
  • Send array to next viewcontroller iOs xcode [duplicate]
  • How to encrypt Connectionstring written in web.config from codebehind?
  • Codeigniniter insert data through models and controller
  • Android Library Projects on Windows and Mac
  • Angular FormGroup won't update it's value immediately after patchValue or setValue
  • PHP Permalinks.. how to change?
  • What does the “id” field in an Android “Google Play Music” broadcast intent correspond to?