日期:2014-05-18  浏览次数:20897 次

org.hibernate.MappingException: Unknown entity: java.util.ArrayList错误。
执行删除的时候页面报
org.springframework.orm.hibernate3.HibernateSystemException: Unknown entity: java.util.ArrayList; nested exception is org.hibernate.MappingException: Unknown entity: java.util.ArrayList

异常。我的HQL语句如下;
Java code
public void cancelYuyue(Long id) {
        
        getHibernateTemplate().delete

(getHibernateTemplate().find("from OrderInstrumentReservation where id="+id+"and status='待审核'"));
        //getHibernateTemplate().find("from OrderInstrumentReservation where adminId="+id+"and status='待审核'");
        
    }



我想做的是:根据用户id 查找,删除 用户status =‘待审核的’ OrderInstrumentReservation对象记录。

执行后后台输出执行SQL语句如下:
Java code
Hibernate: select orderinstr0_.id as id1_, orderinstr0_.instrumentId as instrume2_1_, orderinstr0_.adminId as adminId1_, orderinstr0_.userId as userId1_, orderinstr0_.name as name1_, orderinstr0_.unit as unit1_, orderinstr0_.startTime as startTime1_, 

orderinstr0_.endTime as endTime1_, orderinstr0_.applyTime as applyTime1_, orderinstr0_.actualStartTime as actualS10_1_, orderinstr0_.actualEndTime as actualE11_1_, orderinstr0_.actualCost as actualCost1_, 

orderinstr0_.status as status1_, orderinstr0_.useNumber as useNumber1_, orderinstr0_.actualUseNumber as actualU15_1_, orderinstr0_.remark as remark1_, orderinstr0_.sysTime as sysTime1_, orderinstr0_.timeA as timeA1_, orderinstr0_.timeB as timeB1_, orderinstr0_.timeC as timeC1_, orderinstr0_.timeD as timeD1_, orderinstr0_.timeE as timeE1_, orderinstr0_.timeF as timeF1_, 

orderinstr0_.timeG as timeG1_, orderinstr0_.timeH as timeH1_, orderinstr0_.timeI as timeI1_, orderinstr0_.timeJ as timeJ1_, orderinstr0_.timeK as timeK1_, orderinstr0_.timeL as timeL1_, orderinstr0_.timeM as timeM1_, orderinstr0_.timeN as timeN1_ from 

orderSys.dbo.order_instrumentReservation orderinstr0_ where orderinstr0_.id=53 and orderinstr0_.status='待审核'




------解决方案--------------------
可以遍历通过下面代码返回的集合
find("from OrderInstrumentReservation where id="+id+"and status='待审核'")
取出一个OrderInstrumentReservation对象后再用delete()方法删除