There are two ways to configure Hibernate mappings in spring to implement the
1: When the required mapping file is less, can be implemented by mappingresources
The specific implementation is as follows:
<property name= "Mappingresources" > <list> <value>com/yourcompany/model/teacher.hbm.xml</ Value> <value>com/yourcompany/model/Student.hbm.xml</value> <value>com/yourcompany/model/ School.hbm.xml</value> </list> </property>
The main thing is to use <value> </value> to list the location and name of your mapping file in <list></list>.
The advantages of this realization: more intuitive, easy to understand, the drawback is: if the mapping file too much, one is too much repetition of code, the second is if there is a wrong place to find.
So we can use the following method, just give spring a folder, other things, let Spring do.
2: When there are too many files to map, we can use: Mappingdirectorylocations to implement
Specific as follows:
You can specify or change the Classpath:/com/yourcompany to a folder location by Classpath: web-inf/modelmappings
<property name= "Mappingdirectorylocations" > <list> <value>classpath:/com/yourcompany/model/< /value> </list> </property>