pcyuen98 / covidAngular

0 stars 0 forks source link

KT - Spring Boot Service vs Transactional #11

Closed pcyuen98 closed 3 years ago

pcyuen98 commented 3 years ago

Explain the usages of the annotation below and provide reference link

@Service @Transactional

nurzahidah commented 3 years ago

@Service annotation can be applied only to classes. It is used to mark the class as a service provider that perform some service such as executing business logic, performing calculations and calling external APIs.

@Transactional Metadata that can be consumed by some runtime infrastructure. The scope of a single database transaction.

https://www.journaldev.com/21435/spring-service-annotation https://dzone.com/articles/a-guide-to-spring-framework-annotations

pcyuen98 commented 3 years ago

@Transactional A read-only flag — a hint for the persistence provider that the transaction must be read onlyThe rollback rules for the transaction