Of course, it is most commonly used in concrete classes at the Service level :) In this example, I wanted to introduce you to the lowest level where you can use @Transactional in your project, so I showed you an example of specifying it in the @Repository interface. I make it a habit to specify @Repository and @Service, because that way I can cope with both transactions from real-time APIs with low execution time, and logic that has hours of execution time and intentionally doesn't use service-level transactions.
Thanks to you, I was able to contemplate about lock and isolation.
In source code, you implemented the @Transactional annotation in the Repository Interface, but according to Spring documentation, they recommend setting it at the class level.
how do you think about it?
docs.spring.io/spring-framework/reference/data-ac…
---- I discovered this after making the comment ---- It seems that the Repository with Data JPA interface is an exception where it's permissible to use Transactional.
Unknown
Backend Developer
Thanks to you, I was able to think deeply about lock and isolation. Thank you!
You have set the @Transactional annotation on the Repository interface. I usually prefer to declare it in the Class method of the Service layer... Is it a better practice to declare it in the Repository?