org.springframework.orm.hibernate3.HibernateQueryException: Tb*** is not mapped

2018-07-30 18:06:25 ERROR http-bio-8080-exec-8 impl.SimDAOImpl:288 - 执行查询 from TbsimBoard where containerBoxId = 46 失败
org.springframework.orm.hibernate3.HibernateQueryException: TbsimBoard is not mapped [from TbsimBoard where containerBoxId = 46]; nested exception is org.hibernate.hql.ast.QuerySyntaxException: TbsimBoard is not mapped [from TbsimBoard where containerBoxId = 46]

hibernate查询,出现 is not mapped的错误,说明没有这个查询的映射文件,但很多小伙伴就会有疑问,明明所有映射文件都写好了,Bean对象也建好了,为什么还报这个错。
原因很简单,用hql查询的时候,是区分bean对象的大小写的,也就是说我的bean对象名称是TbSimBoard,但是我在查询的时候写的是TbsimBoard,所以hibernate找不到该映射。
所以说,做人还是老实点,有大小写之分的时候就老老实实区分一下,即使大小写不影响,但还是照原本的大小写码出来吧。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章