2

I'm currently dealing with a codebase where the business code uses the @Transactional annotation from the javax.transaction package. However, this software also uses spring-data JPA repositories, which uses the Spring @Transactional annotation. Since we discovered this, we switched to using Spring @Transactional annotation on all newer business code.

My questions are:

  • Does using both different annotation cause any kind of problem ? I'm guessing not because we discovered the problem during a code refactoring but we didn't notice any defect related to this problem. However, I prefer to be sure
  • What's the difference in behavior between the two annotations ?

Thanks in advance.

Jonik
  • 80,077
  • 70
  • 264
  • 372
Kaidjin
  • 1,433
  • 1
  • 12
  • 18
  • 1
    Depending on the Spring version in use the `java.transaction.Transactional` is ignored, support was added in Spring 4. There shouldn't be any difference in behavior between the 2. – M. Deinum Dec 22 '14 at 14:29
  • Related questions: http://stackoverflow.com/questions/26387399/javax-transaction-transactional-vs-org-springframework-transaction-annotation-tr and http://stackoverflow.com/questions/10505160/difference-between-jta-and-spring-transactional-annotations – Jonik Oct 24 '15 at 09:26

0 Answers0