I've added an OpenSessionInViewInterceptor (OSIVI) to my code to allow my JSPs to access lazily loaded associations. I already had a transaction manager setup and my services make use of the @Transactional annotation. This still works well for reading but writing only works in non request code, e.g. bean initialisation code - unless I set the flush mode name to FLUSH_AUTO.
I understand that the OSIVI does not auto flush by default. This is fine - my views only need to read, but from the documentation I thought that the code marked by @Transactional would continue to flush itself. Is my assumption wrong? Should I need to use FLUSH_AUTO?
Interceptor and transaction manager:
Without the AUTO FLUSH everything appeared to work without error except that nothing ever persisted.
<property name="sessionFactory" ref="sessionFactory" />
<ref bean="sessionFactory" />
<property name="flushModeName" value="FLUSH_AUTO"/>