配置文件已经做了如下配置
PROPAGATION_REQUIRED,-Exception
但在DAO 中执行下面代码时出现 org.springframework.dao.InvalidDataAccessApiUsageException: Write operations are not allowed in read-only mode (FlushMode.NEVER) - turn your Session into FlushMode.AUTO or remove 'readOnly' marker from transaction definition
异常。
[code="java"]
public void saveUserInfo(User user) {
// TODO Auto-generated method stub
//getSession().setFlushMode(FlushMode.AUTO);
//getSession().save(user);
//getSession().flush();
getHibernateTemplate().save(user);
}
[/code]
网上搜索了一下,除了手动设置FlushMode.AUTO,就是改spring的配置文件。配置文件已经做了如下配置
PROPAGATION_REQUIRED,-Exception 仍然出错,不知道为什么,希望得到解答。谢谢!