User is not mapped problem in SSH frame hibernate

Source: Internet
Author: User

user is not mapped problem in SSH frame hibernate
  When you do the SSH framework consolidation, when you are doing DAO operations. Only the Chekuser () method is called here. Run Times
user is not mapped error:
The Chekuser () method is as follows:
public boolean chekuser (user user) {
String hql= "from user U where u.id=? and u.name=? ";
Query query=getsession (). CreateQuery (HQL);
Query.setinteger (0, User.getid ());
Query.setstring (1, User.getname ());
List list=query.list ();
if (List.size () >0&&list!=null) {return true;}
return false;
}

When the above statement went wrong, because I wrote the HQL statement, the statement I wrote was:
String hql= "from user U where u.id=? and u.name=?";

but the table name in the HQL statement should be the class name of the ORM map, not the table name in your database.
So change the table name of the user in the HQL statement to user, and change the following:
String hql= "from User u where u.id=? and u.name=? ";
just change the class name to the ORM map.
In the second run will not be reported no XXX is not mapped wrong.

User is not mapped problem in SSH frame hibernate

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.