在用hibernate框架时,
运行时报org.hibernate.hql.ast.QuerySyntaxException:tab_user is not mapped [select u.username from tab_user u where u.username=? and and u.password=?] 错误:
上面的错误是因为自己写了错误的HQL语句:
String hql ="select u.username from tab_user u where u.username=? and u.password=?";
但是在HQL语句中表名应该是ORM映射的类名,而不是你在数据库中的表名,
所以将HQL语句中的tab_user的表名改为ORM映射的类名即可。
再次运行就不会报这样的错了。