tb_Countries_Name is not mapped [from tb_Countries_Name where Id = '1' ]

版权声明:转载请标注来源:https://me.csdn.net/qq_37844454 https://blog.csdn.net/qq_37844454/article/details/82987950

在项目的数据库创建表的时候,遵循了建表的规则:tb_***_**,然而hibernate在映射的时候系统自动把下划线_给去掉了直接变为:TbXXX,在Javabean里做hql查询的时候没有注意,写的是数据库名:from tb_***_***,导致出现tb_Countries_Name is not mapped [from tb_Countries_Name where Id = ...这样的问题:

其实,上面的查询语句的思路是有问题的,正确的思路是从该数据表对应的实体中查询(该实体在生成的时候同样自动省去了下划线),所以,正确的写法应该是:from Tb****。

猜你喜欢

转载自blog.csdn.net/qq_37844454/article/details/82987950
今日推荐