Mappinglocations, mappingdirectorylocations, and mappingjarlocations differences
Since spring's integration of Hibernate profile Hibernate.cfg.xml is pretty good,
so, In the project I have been using spring's org.springframework.orm.hibernate.LocalSessionFactoryBean to replace the functionality of the Hibernate.cfg.xml file
Localsessionfactorybean has several properties to look up hibernate mapping files: mappingresources, Mappinglocations, Mappingdirectorylocations and Mappingjarlocations
Their differences:
Mappingresources: Specify a specific map file name under Classpath
Petclinic.hbm.xml
Mappinglocations: You can specify any file path, and you can specify a prefix: classpath, file, and so on
/web-inf/ Petclinic.hbm.xml
Classpath:/com/company/domain/petclinic.hbm.xml
can also be specified with a wildcard character,???? *???? Specify a file (path) name,???? **???? Specify multiple file (path) names, for example:
Classpath:/com/company/domain/**/maps/*.hbm.xml
The configuration above is in the com/company/ The Hbm.xml file under any maps path under the domain package is loaded as a mapping file
Mappingdirectorylocations: Specifies the mapped file path
Mappingjarlocations: Specifies that the loaded mapping file is in the jar file