请教了两表是双向外键关联 ,无法删除表我该咋办呢

解决方案 »

  1.   

    http://blog.csdn.net/shadow55/archive/2009/08/09/4428059.aspx
      

  2.   

    客服与包裹  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);
    }