hibernate用Session查询时报java.lang.String cannot be cast to java.util.Map异常
报错代码如下:IteratortbSIt=s.createQuery("SELECTt.strName,tt.strNameASstrCurName,ts.isVisib...
报错代码如下:Iterator tbSIt = s.createQuery("SELECT t.strName,tt.strName AS strCurName,ts.isVisible FROM pl_viewModelToolbarStatus ts LEFT JOIN ts.uidToolbar t LEFT JOIN ts.uidCurToolbar tt WHERE ts.uidViewModel=?").setParameter(0, uidViewModel).iterate();
详细错误如下:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at org.hibernate.property.MapAccessor$MapGetter.get(MapAccessor.java:118)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:227)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3876)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3584)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:456)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:130) 展开
详细错误如下:
java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Map
at org.hibernate.property.MapAccessor$MapGetter.get(MapAccessor.java:118)
at org.hibernate.tuple.entity.AbstractEntityTuplizer.getIdentifier(AbstractEntityTuplizer.java:227)
at org.hibernate.persister.entity.AbstractEntityPersister.getIdentifier(AbstractEntityPersister.java:3876)
at org.hibernate.persister.entity.AbstractEntityPersister.isTransient(AbstractEntityPersister.java:3584)
at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:203)
at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:242)
at org.hibernate.type.EntityType.getIdentifier(EntityType.java:456)
at org.hibernate.type.ManyToOneType.nullSafeSet(ManyToOneType.java:130) 展开
展开全部
字面意思是string类型不能转换为map类型,没到你源码和报错的地方,所以不好回答啊
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
类型错误,String不能转换成map类型,看看配置文件,是不是类型写错了
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询