用hibernate一对一关联的两张表该如何删除? 请教了两表是双向外键关联 ,无法删除表我该咋办呢 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 http://blog.csdn.net/shadow55/archive/2009/08/09/4428059.aspx 客服与包裹 1对多customer.hbm.xml<set name="packageInfos" inverse="true" cascade="all"> <key> <column name="CustomerId" /> </key> <one-to-many class="com.logistics.bean.PackageInfo" /> </set>package.hbm.xml<many-to-one name="customerInfo" class="com.logistics.bean.CustomerInfo"> <column name="CustomerId" /> </many-to-one>删除的时候,不能new 一定要用dao从数据库拿出来Customer customer = this.customerDao.get(customerId);if(customer != null) { this.customerDao.delete(customer);} webwork+Hibernate+spring写数据库问题 用tomcat,apache还用单独安装吗? jsp 从显示图片 取数据库中的二进制data Tomcat的问题高手帮忙 各种大神请进 菜鸟学j2ee希望大家帮忙啊!! 困扰很久的消息BEAN的7个问题!非常希望得到解决! 高手,我安装了jbuilder9,还要不要安装j2ee1.4呀 执行.wsdd文件出错,求助 关于会话Bean和实体Bean?都有分 关于JS的,有点急!! 100分 求 J2EE的医疗门诊查询系统
customer.hbm.xml
<set name="packageInfos" inverse="true" cascade="all">
<key>
<column name="CustomerId" />
</key>
<one-to-many class="com.logistics.bean.PackageInfo" />
</set>package.hbm.xml
<many-to-one name="customerInfo" class="com.logistics.bean.CustomerInfo">
<column name="CustomerId" />
</many-to-one>删除的时候,不能new 一定要用dao从数据库拿出来
Customer customer = this.customerDao.get(customerId);
if(customer != null) {
this.customerDao.delete(customer);
}