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找不到該映射。
所以說,做人還是老實點,有大小寫之分的時候就老老實實區分一下,即使大小寫不影響,但還是照原本的大小寫碼出來吧。

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