Thursday 12 May 2016

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


org.springframework.dao.InvalidDataAccessApiUsageException: 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.
at org.springframework.orm.hibernate4.HibernateTemplate.checkWriteOperationAllowed(HibernateTemplate.java:1135)
at org.springframework.orm.hibernate4.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:620)
at org.springframework.orm.hibernate4.HibernateTemplate$12.doInHibernate(HibernateTemplate.java:617)
Below of the piece of code worked for me. Added @Transactional annotation where i was performing insert operation
@Transactional
public void sendVoice(VoiceUser voiceUser) {
                    feedSendVoice.save(voiceUser)
 }

No comments:

Post a Comment