2

I have read lot of question and answers regarding above mentioned title. But I am not still clear with it. If any one can explain it it would be really useful for me and others, I wish.

  1. My doubt is do we really want to use @Transactional on method level for read-only operation ?
  2. If your answer is yes and you are saying that use of propagation=read-only. I have observed that after fetching spring is taking some time for setting read-only flag back to false. and also it is doing commit operation. I think it will cause a performance issue.
  3. I can do fetching operation with out using @Transactional in service layer. Instead I will create an open session in DAO it self and perform the action. That time I have observed that, execution is faster.

But I am not sure while doing like this am i trading any data integrity. I am using spring+hibernate. It will be very helpful if you give me an answer covering all the aspect .

M. Deinum
  • 115,695
  • 22
  • 220
  • 224
  • See http://stackoverflow.com/questions/2562865/spring-transaction-readonly – Pino Sep 30 '14 at 12:43
  • See http://stackoverflow.com/questions/17505204/hibernate-read-only-transaction and http://stackoverflow.com/questions/13539213/why-do-i-need-transaction-in-hibernate-for-read-only-operation – Mektoub Sep 30 '14 at 15:12

0 Answers0