Try it yourself tonight.Hibernate to build a Web project and then go for a simple login.
This is always the case when you do a query through Hibernate:
Users is?not?mapped.
So to check the next mapping, found no problem ah, repeated verification results are the same error.
User.hbm.xml:
<class name= "Com.lian.bean.User" table= "Users" >
Hibernate.cfg.xml:
<mapping resource= "Com/lian/bean/user.hbm.xml"/>
On the internet to find a lot, but still do not give force, we did not mention some constructive solutions, basically said configuration has a problem.
But I feel like this is a problem:
String sql = "Select U.password from Users u where u.username= '" +user.getusername () + "'";
After a lot of tangled and patient looking for information, found:
The table name in the original HQL statement should be the class name of the ORM map, so it should be changed to:
String sql = "Select U.password from User u where u.username= '" +user.getusername () + "'";
The SQL statement looks for the generated user class, not the normal table .....
Table name (XXX) is not mapped problem in Hibernate