from several different sources. The principal advantage of using the mappingLocations property is that you can specify a resource path to the mapping files as opposed to the absolute path to the mapping file. This is all well and good but what does this actually mean. Rather than specifying the individual hibernate mappings as shown below: Code Block |
---|
<value>edu/mit/csf/example/academic/hibernate/AcademicTerm.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/AcademicTermDate.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/AcademicYear.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/Department.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/EnrollmentStatus.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/Course.hbm.xml</value>
<value>edu/mit/csf/example/academic/hibernate/Citizenship.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/Student.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/StudentOtherMitId.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/StudentMitId.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/ArchivedStudent.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/ArchivedStudentOtherMitId.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/ArchivedStudentMitId.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/Country.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/State.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/StudentAddress.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/StudentEmail.hbm.xml</value>
<value>edu/mit/csf/example/student/hibernate/StudentPhone.hbm.xml</value>
|
Using the mappingLocations property, you can now specify wildcards in the resource path to match multiple files so that you don't have to configure a hibernate mapping file location every time you add a new mapping file. This reduces the 16 lines in the above to the following 2 lines shown below: Code Block |
---|
<value>classpath*:edu/mit/csf/example/academic/hibernate/*.hbm.xml</value>
<value>classpath*:edu/mit/csf/example/student/hibernate/*.hbm.xml</value>
|
|