struts adction 中,为了得到表单类容,声明了实体userInfo,然后表单那边些name=userInfo.username;
action中直接 save(userInfo);
这样第一次添加的时候不报错,但是继续添加将出现
org.hibernate.HibernateException: Don't change the reference to a collection with cascade="all-delete-orphan"
原因是因为第一次保存时userInfo已经和数据库关联了,继续保存当然会报错了。
解决方法不用我说了吧!