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.
- My doubt is do we really want to use
@Transactional
on method level for read-only operation ? - 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. - 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 .