双向关联级联删除出现问题

我在系统中建立了一个这样的关系

Customer<客户> news<新闻> pinglun<评论>

customer.hbm.xml文件代码
[code]

.......
<set name="pingluns" lazy="true" inverse="true" cascade="all-delete-orphan">
<key column="Customer_id"/>
<one-to-many class="pinglun"/>
</set>

<set name="newses" lazy="true" inverse="true" cascade="all-delete-orphan">
<key column="Customer_id"/>
<one-to-many class="news"/>
</set>
......
[/code]

news.hbm.xml文件代码
[code]
......
<set name="pingluns" lazy="true" inverse="true" cascade="all-delete-orphan">
<key column="News_id"/>
<one-to-many class="pinglun"/>
</set>

<many-to-one name="newsauthor"
column="Customer_id"
class="Customer"/>
......
[/code]

pinglun.hbm.xml文件代码
[code]
<many-to-one name="plauthor"
column="Customer_id"
class="Customer"/>

<many-to-one name="News"
column="News_id"
class="News"/>
[/code]
可是在我级联删除时总是出现这个错误 当然删除普通的没问题 我现在选择的是删除那些发表过文章和评论的人
[code]

Failed to lazily initialize a collection
在控制台的错误代码
Caused by:could not initialize collection: [com.eric.object.Customer.pingluns#350]

Caused by: java.sql.SQLException: 流已被关闭

[/code]
各种参数我都尝试过 为什么还是不能级联删除?
对了 我的action中只是简单的传递一个ID 过去,然后调用service层来删除用户
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值