Sunday, 22 November 2009

InvalidDataAccessApiUsageException with Spring and NHibernate

If you get a Spring.Dao.InvalidDataAccessApiUsageException with the following message…

“Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition”

…check that you have added the [Transaction(ReadOnly = false)] attribute to the appropriate data access method (assuming it’s a method that modifies data). Alternatively, if the attribute is already present, check that ReadOnly is not set to true.

0 comments:

Post a Comment

By all means leave a comment. I may not be able to get back to you as quickly as I'd like but I'll do my very best.