各位兄弟姐妹,帮我看看这样的问题,SSH集成开发的项目,我在struts调用DAO时候,执行了两次load,因为我要加载这两个对象来更新,可是他报错了,有可能前面那次把session关闭了,下一个load方法就不可以调用了,那怎么办呢?这两个对象是ONE-TO-MANY关系。事务是用spring事务管理器配置实现的。
解决方案 »
- Tomcat里的server.xml里的这段程序:<Context path="/mvc" docBase="" privile="true"/>
- 好像是SSH配置问题,请各位朋友有空进来帮帮忙
- 跟着老师做例子,遇到的类不能继承问题。请教
- 请进,关于spring中aop应用中通知的应用顺序
- 使用lomboz插件后无法运行jsp
- 求救关于百度新闻搜索引擎中抓取关键字的问题。
- java开源了?
- 从oracle中select timestamp字段报错?java.sql.SQLException: 类型长度大于最大值
- JBOSS JSP页面编译错误
- 用java把数据库中数据插入到xml中,blob字段怎么解决
- 请教下svn权限的问题
- 求ssh整合的简单一对一例子
HttpServletRequest request, HttpServletResponse response)
throws Exception {
LazyValidatorForm f = (LazyValidatorForm) form;// 获得动态懒form
String id=(String)f.get("id");
String bt = (String) f.get("bt");
String write_type = (String) f.get("write_type");
String con = (String) f.get("con");
String write_heart = (String) f.get("write_heart");
String write_quanxian = (String) f.get("write_quanxian");
Writetype wr=this.writestypedaoImpl.find_Writetype(new Integer(write_type));//加载一次
Writes w=this.writesdaoImpl.find_Writes(new Integer(id));//加载2次
w.setWrite_bt(bt);
w.setWrite_con(con);
w.setWritetype(wr);
w.setWrite_date(new Date());
w.setWrite_heart(write_heart);
w.setWrite_quanxian(write_quanxian);
this.writesdaoImpl.modify_Writes(w); return mapping.findForward("writes_list_add");
}听网上说这是session管理问题,但我这里是用spring管理事务,报错如下
org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: [com.cw.pojo.Writes#23]Writes表是外键表,是多的一方,而Writetype是一的一的一方,当我更新一的一方时候同时更新Writetype