intellij compiled springmvc + hibernate + spring + maven hbm.xml mapping file can not be found

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) Project hibernate reverse engineering with persistant intellij of tools to complete, after the final completion of the object model and mapping files are stored in the directory of model.

(2) Since we set the src folder is stored code, resource folder is stored resources, therefore intellij at compile time ignores the src folder below the xml file, leading to the final release of these folders are missing following mapping file.

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

 

3. Solution

The establishment of a directory with the same name in the resource directory folder save the corresponding xml file.

My configuration:

Description:

mappingDirectoryLocations: Batch reading
mappingResources: reading a single profile

 

 

Reference: https: //www.cnblogs.com/weishenhong/p/5309430.html

Guess you like

Origin www.cnblogs.com/116970u/p/11106820.html