Hibernate 中出现 users is not mapped 问题

hibernate.cfg.xml中:

原代码:

<hibernate-mapping auto-import="false" default-access="field" default-lazy="false">
 <class name="pojo.User" table="tb_users">

修改后代码:

<hibernate-mapping >

 <class name="pojo.User" table="tb_users">

成功运行!

HQL语句中表名应该是ORM映射的类名,而不是在数据库中的表名

猜你喜欢

转载自blog.csdn.net/qq_35507234/article/details/79490761