Springmvc problem xxx is not mapped [from XX] or unknown Entity:com.spring.main.pojo.Person

Source: Internet
Author: User

Springmvc problem xxx is not mapped [from XX] or unknown Entity:com.spring.main.pojo.Person


It took a day till the wee hours to find a place not configured

At the beginning of the HQL statement is wrong, but found no, online search to search is said Pojo class name written in the table name, so that the low-level error may have, examined n times, found not, but why will still report the same error? This error was found when I used the Get method to get database records instead unknown Entity:com.spring.main.pojo.Person, later found that is not the mapping note is wrong, then what happened, depressed for a long time long, long time ......

Last start line look at the Spring config file, by the way, I found the datasourse need to scan this damn bean.

<property name= "Packagestoscan" value= "com.spring." ></property>

<!--configuration Sessionfactory--><bean id= "Sessionfactory" class= " Org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean "><property name=" DataSource " ref= "DataSource"/><!--start the annotation function of spring MVC, complete the mapping of the annotations Pojo  No such sentence will not be used HQL inquiry, the error is reported without mapping--><property name= " Packagestoscan "value=" com.spring. " ></property><property name= "hibernateproperties" ><props><prop key= "Hibernate.dialect" >org.hibernate.dialect.oracledialect</prop><prop key= "Hibernate.show_sql" >true</prop>< Prop key= "Hibernate.generate_statistics" >true</prop></props></property></bean>


Problem solving

Springmvc problem xxx is not mapped [from XX] or unknown Entity:com.spring.main.pojo.Person

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.