is there any difference between:
- add “@Transactional” annotation to whole class
- add for every single method “@Transactional” annotation ?
Using spring and Hibernate ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Basically, if you annotate the class with
@Transactionalall methods will be transactional.If you don’t, you can annnotate as
@Transactionalonly those methods you want to. Additionally, you can specify different attributes for each method, likeisolation,propagation,timeout, …Also, take a look at this question, this is a possible duplicate of it: Hibernate transaction annotations in source — difference between class and method level use?