在struts-config.xml中加上“,/WEB-INF/applicationContext.xml”,则可以关联删除,去除则报错
deleted object would be re-saved by cascade
struts-config.xml配置部分如下:
[code="xml"]
className="org.springframework.web.struts.ContextLoaderPlugIn">
value="/WEB-INF/action-servlet.xml,/WEB-INF/applicationContext.xml" />
[/code]
web.xml如下:[code="java"]<?xml version="1.0" encoding="UTF-8"?>
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
jmesaPreferencesLocation
WEB-INF/jmesa.properties
Set Character Encoding
filters.SetCharacterEncodingFilter
encoding
GBK
pagefilter
com.page.PageFiter
<filter>
<filter-name>AuthorSession</filter-name>
<filter-class>filters.AuthorSessionFilter</filter-class>
AuthorSession
.jsp
AuthorSession
.do
hibernateFilter
filters.OpenSessionInViewFilter
<!-- org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
-->
hibernateFilter
.do
Set Character Encoding
/
pagefilter
*.do
org.springframework.web.context.ContextLoaderListener
action
org.apache.struts.action.ActionServlet
config
/WEB-INF/struts-config.xml
debug
3
detail
3
application
ApplicationResources.properties
0
ImageServlet
net.sf.jasperreports.j2ee.servlets.ImageServlet
action
*.do
ImageServlet
/servlets/image
login.jsp
/tld/jmesa.tld
/WEB-INF/tld/jmesa.tld
BASIC
[/code]
staff.xml配置:[code="java"]<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
员工
组织ID
上级ID
员工编号,组织为每个员工派发的号码
员工姓名
员工类型
员工ID
[/code]
sysUser.xml如下[code]
[/code]
在struts-config里面配置plug-in和web里面配置listener不是一回事的,
后者作为Spring为一大组件,
你把你配置其中一个时所报的错贴出来一下,看了错误就要好说一点
你是做SSH项目?
可以说是加入Spring配置信息,这样在Action里面实现AOP依赖注入
你的这个问题我前几天正好出现过,你在staff.xml配置中将
改为
补充:我的错误时这样的
参见:http://www.iteye.com/problems/34691
级联删除时出错
web.xml中配置applicationContext.xml由listener来执行,就是整个项目用到Spring的都会去读applicationContext.xml
楼上的那个写法你试试
之所以报那个错在你删除之后Session里还有你删除的那个对象而你cascade设置的是all然后Spring又帮你saveorupdate一次,
而当你flush一下,就把Session里的对象清空了,