Just wanted your expert opinions on declarative transaction management for Spring. Here is my setup:
- DAO layer is plain old JDBC using Spring JdbcTemplate (No Hibernate etc)
- Service layer is POJO with declarative transactions as follows -
save*, readonly = false, rollback for Throwable
Things work fine with above setup. However when I say get*, readonly = true
, I see errors in my log file saying Database connection cannot be marked as readonly
. This happens for all get* methods in service layer.
Now my questions are:
A. Do I have to set get*
as readonly? All my get*
methods are pure read DB operations. I do not wish to run them in any transaction context. How serious is the above error?
B. When I remove the get*
configuration, I do not see the errors. Morever, all my simple get*
operations are performed without transactions. Is this the way to go?
C. Why would anyone want to have transactional methods where readonly = true
? Is there any practical significance of this configuration?
Thank you! As always, your responses are much appreciated!