I have an application using Spring with Hibernate on a MySQL database. For some reason, as of the last few days, anytime I try to persist any objects to my database I am getting
After about 3 hours of horrible debugging I now know what's going on. I have a service-level method that I also have an "around" advice on. The service-level method is annotated with @Transactional(readOnly=true)
, however, I have another service in my advice that was annotated with @Transactional(readOnly=false)
.
My aspect (or advice) is using the same DAO objects as my normal service-layer, so when I called sessionFactory.getCurrenctSession()
it's giving me back the session that was created for my Read-Only Service-level method. Now, I have to re-architect.