[RPC Fault faultString="
java.lang.RuntimeException : 删除法人信息出现异常!" faultCode="Ser
public void deleteCorporative(String itemId) {
try{
List<TCorporation> result=corporativeDao.getTCorporationByActiveId(itemId);
for(TCorporation tempObj:result){
corporativeDao.delete(tempObj);
}
corporativeDao.delete(TCorporative.class,itemId);
}catch(Exception e){
e.printStackTrace();
throw new
RuntimeException ("删除法人信息出现异常!");
}
}
public ICorporativeDao CorporativeDao=null ;
public List<TCorporation> getTCorporationByActiveId(String itemId) {
// TODO Auto-generated method stub
List<TCorporation> result=new ArrayList();
Session session = this.CorporativeDao.getCurrentSession();
result=session.createQuery("from T_CORPORATIVE t,T_CORPORATION s on t.id=s.id and t.id='"+itemId+"'").list();
return result;
}
两个函数什么地方报错呢。
------解决方案--------------------
把数据库直接改成级联删除不就行了吗?
------解决方案--------------------
删除方法不对,用iterator循环,iterator.remove方法删除!