Write operations are not allowed in read-only mode (FlushMode.MANUAL)

SSH error information:
HTTP Status 500 – Internal Server Error
Type Exception Report
Message Write operations are not allowed in read-only mode (FlushMode.MANUAL): Turn your Session into FlushMode.COMMIT/AUTO or remove ‘readOnly’ marker from transaction definition.
Description The server encountered an unexpected condition that prevented it from fulfilling the request.


SSH error cause:

1
2
3
4
5
6
7
<!-- database tx configuration -->
<bean id="transactionManager"
class="org.springframework.orm.hibernate5.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- Don't forget to add annotation at using tx place -->
<tx:annotation-driven transaction-manager="transactionManager" /> <!-- permit annotation -->


SSH error solution:
Use annotation above the class where the method in the class deals with database.

1
@Transactional