Search code examples
spring-data-jpatransactions

Do Jpa methods create their own transactions?


I was wondering whether jpa methods execute within transactions or without them. If i introduce @Transactioanl annotation, i understand that all the database queries within the scope of the annotation will execute within a single transaction.

Does that mean a @Transactional annotation overrides jpa methods' transaction settings, or is it that jpa methods, by themselves do not create a transaction?


Solution

  • Found the answer - Yes , JPA Methods save and saveAll do create their own transactions: https://www.baeldung.com/spring-data-save-saveall