Hibernate configuration:
<hibernate-mapping> <classname= "Com.um.user.User"Table= "User"> <IDname= "id"type= "Java.lang.Integer"> <columnname= "ID"Precision= "All" Scale= "0" /> <Generatorclass= "Identity" /> </ID> < Propertyname= "username"type= "Java.lang.String"> <columnname= "USERNAME"length= "+"Not-null= "false"> <Comment>User name</Comment> </column> </ Property> < Propertyname= "Password"type= "Java.lang.String"> <columnname= "PASSWORD"length= "+"Not-null= "false"> <Comment>Password</Comment> </column> </ Property> </class></hibernate-mapping>
querying the database: Public List<user> FindAll () { String queryString = "from User"; List<User> list =this. Gethibernatetemplate (). Find (queryString); return list;
When the above code runs, it appears:
User isn't mapped [from user]
Processing method:
String queryString = "from user"; should be changed to:
String queryString = "from User";
Because, however, the table name in the HQL statement should be the class name of the ORM map, not the table name in your database.
Just change the user database table name to the mapped class name user.
User is not mapped [from user] Error resolution