我就是新建的一个简单的java项目,没有放在web工程中,想测试一下spring+hibernate的实现下效果,结果出现如下提示:
Exception in thread "main" 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:1128) at org.springframework.orm.hibernate4.HibernateTemplate$20.doInHibernate(HibernateTemplate.java:737) at org.springframework.orm.hibernate4.HibernateTemplate.doExecute(HibernateTemplate.java:341) at org.springframework.orm.hibernate4.HibernateTemplate.executeWithNativeSession(HibernateTemplate.java:309) at org.springframework.orm.hibernate4.HibernateTemplate.persist(HibernateTemplate.java:734) at com.csu.test.SpHiTest.main(SpHiTest.java:26)
各位走过路过的大神,帮忙看看,,
没人回答只能自己整了,把hibernate4换成hibernate3才成功解决