FlushMode.COMMIT error during testing
Got this mysterious error message while running integration tests:
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...
This threw me off since I've never seen this error before nor made any changes to that particular integration tests / class. When I tested the application manually everything worked as expected...
As it turned out the problem was with a seemingly unrelated domain class which was not properly persisted [in the test] and returned an error in the object.save() call. Since the error message does not indicate the cause of the problem this fairly simple issue was tough to debug.
Written by Andrei Taraschuk
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Grails
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#