How should I overcome from this hibernate error of java Write operations are not allowed in read-only mode

Home / Uncategorized / How should I overcome from this hibernate error of java Write operations are not allowed in read-only mode

Question:
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)


Answer:
In you spring context part, set the following.


I think your current is set as :
Also you can set @Transactional(readOnly = false) to ur class method (let’s say DAO Class methods like persist, update or delete) which need to write in database.
@Transactional(readOnly = false)
public void UpdateEmployee() {


}
Read more

Leave a Reply

Your email address will not be published. Required fields are marked *