SSH execution HQL error: caused by:org.hibernate.hql.ast.QuerySyntaxException:user is not mapped [from user where username =?]

Source: Internet
Author: User

Error message:

ERROR dispatcher:38-exception occurred during processing request:user is isn't mapped [from user where username =?]; Nested exception is org.hibernate.hql.ast.QuerySyntaxException:user are not mapped [from user where username =?]
Org.springframework.orm.hibernate3.HibernateQueryException:user is isn't mapped [from user where username =?]; Nested exception is org.hibernate.hql.ast.QuerySyntaxException:user are not mapped [from user where username =?]
......
Caused By:org.hibernate.hql.ast.QuerySyntaxException:user is isn't mapped [from user where username =?]
......

See the first reaction of the information, mapping error

1. Are there any User.hbm.xml files

2. Whether the profile is loaded into the Hibernate entities list

3. Whether the mapping file field is consistent with the database field, with the correct keyword

Still wrong (since it's not the user's fault, it's a database problem)

Convenient for diagram start database dialect is mysqldialect, compatibility may be a problem, change to Mysql5dialet, that is, configure <prop key= "Hibernate.dialect" > Org.hibernate.dialect.MySQL5dialect</prop>

--Still error (* * database statement error?) **)

String hql = "from user where username =?";
list<user> list = This.gethibernatetemplate (). Find (hql, username); Error???

  Focus : HQL uses entity query technology, such as the following example: String hql= "from user User"; List list=session. CreateQuery (HQL). List (); The result of the above code execution is to query out all the data corresponding to the user entity object , and encapsulate the data into a user entity object, and put it back in the list

Therefore, the above HQL statement error, HQL statement, must be an object query, especially "TableName" do not write the table you want to query, but the object of the query

(Here, user is the database table name and the user object should be queried)

  

SSH execution HQL error: caused by:org.hibernate.hql.ast.QuerySyntaxException:user is not mapped [from user where username =?]

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.