用hibernate的Session的createQuery(sql).setParameter(0,"").iterate()方法后遍历返回Map报错?
hql语句:sql语句:Stringsql="SELECTd.uid,d.uidViewModel,d.uidViewEntityDetail,d.uidControl,...
hql语句:sql语句:String sql = "
SELECT d.uid,d.uidViewModel,d.uidViewEntityDetail,d.uidControl,
d.strName,d.strText,d.strText_en,d.strDataType,d.uidRefer,
d.strReferType,d.strReferRule,d.strDefaultValue,d.isReadOnly,
d.isHidden,d.isNotNull,d.strPosition,d.intWidth,d.intHeight,
d.intTop,d.intLeft,d.intRadixPoint,d.isAmount,d.isFixLength,
d.strAmountRule,d.strFont,d.intColLength,d.intIndex,d.dg_isMutilSelect,
d.dg_isShowSelect,d.dg_isScrollView,d.dg_isColSortable,
c.strControlName,c.strControlText,e.uidQuery
FROM pl_viewModelDetail d
LEFT JOIN d.uidControl c
LEFT JOIN d.uidViewEntityDetail ed
LEFT JOIN ed.uidViewEntity e
WHERE d.uidViewModel.uid=? ORDER BY d.intIndex
错误如下:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map
at tSinge.test.dao.Demo.testSysHbm(Demo.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
我将iterate()返回的对象遍历,将next()方法返回的对象转成Map就报上述错误,不知道为什么?
Iterater.next()返回的不就是Map对象嘛?之前一直这样用没问题的 展开
SELECT d.uid,d.uidViewModel,d.uidViewEntityDetail,d.uidControl,
d.strName,d.strText,d.strText_en,d.strDataType,d.uidRefer,
d.strReferType,d.strReferRule,d.strDefaultValue,d.isReadOnly,
d.isHidden,d.isNotNull,d.strPosition,d.intWidth,d.intHeight,
d.intTop,d.intLeft,d.intRadixPoint,d.isAmount,d.isFixLength,
d.strAmountRule,d.strFont,d.intColLength,d.intIndex,d.dg_isMutilSelect,
d.dg_isShowSelect,d.dg_isScrollView,d.dg_isColSortable,
c.strControlName,c.strControlText,e.uidQuery
FROM pl_viewModelDetail d
LEFT JOIN d.uidControl c
LEFT JOIN d.uidViewEntityDetail ed
LEFT JOIN ed.uidViewEntity e
WHERE d.uidViewModel.uid=? ORDER BY d.intIndex
错误如下:
java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to java.util.Map
at tSinge.test.dao.Demo.testSysHbm(Demo.java:153)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
我将iterate()返回的对象遍历,将next()方法返回的对象转成Map就报上述错误,不知道为什么?
Iterater.next()返回的不就是Map对象嘛?之前一直这样用没问题的 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询