IntelliJ compilation Springmvc+hibernate+spring+maven Unable to find hbm.xml mapping file

Source: Internet
Author: User
1. Error messages

Invocation of Init method failed; Nested exception is org.hibernate.mappingnotfoundexception:resource:model/department.hbm.xml not found
At

2. Error analysis

(1) The project's Hibernate reverse engineering is done using IntelliJ's persistant tool, and the model objects and mapping files are saved in the catalog after the final completion.

(2) Since we have set the SRC folder to hold the code, the resource folder is a resource, so IntelliJ will ignore the XML file under the SRC folder at compile time, resulting in the loss of these mapping files under the last folder being published.

For details, refer to: http://stackoverflow.com/questions/2843949/ How-to-configure-hibernate-tools-with-maven-to-generate-hibernate-cfg-xml-hbm

3. Solution

Create a folder with the same name as the directory under the Resource directory, and save the appropriate XML file.

IntelliJ compilation Springmvc+hibernate+spring+maven Unable to find hbm.xml mapping file

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.