Java / Hibernate – Write operations are not allowed in read-only mode
That error message is typically seen when using the Spring OpenSessionInViewFilter and trying to do persistence operations outside of a Spring-managed transaction. The filter sets the session to FlushMode.NEVER/MANUAL (depending on the versions of Spring and Hibernate you’re using–they’re roughly equivalent). When the Spring transaction mechanism begins a transaction, it changes the flush mode to … Read more