Spring 查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocatio
来源:互联网 发布:高尔夫7原厂轮毂数据 编辑:程序博客网 时间:2024/06/06 12:34
mappingDirectoryLocations
由于spring对hibernate配置文件hibernate.cfg.xml的集成相当好, 可以使用spring的org.springframework.orm.hibernate3.LocalSessionFactoryBean来取代hibernate.cfg.xml文件的功能
LocalSessionFactoryBean有好几个属性用来查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocations
他们的区别:
mappingResources:指定classpath下具体映射文件名
<property name="mappingResources"> <value>petclinic.hbm.xml </value> </property>
mappingLocations:可以指定任何文件路径
<property name="mappingLocations"> <value>/WEB-INF/petclinic.hbm.xml </value> </property>
或者指定前缀:classpath、file等
<property name="mappingLocations"> <value>classpath:/com/company/domain/petclinic.hbm.xml </value> </property>
也可以用通配符指定,'*'指定一个文件(路径)名,'**'指定多个文件(路径)名,例如:
<property name="mappingLocations"> <value>classpath:/com/company/domainmaps/*.hbm.xml </value> </property>
上面的配置是在com/company/domain包下所有hbm.xml文件都被加载为映射文件
mappingDirectoryLocations:指定映射的文件路径
<property name="mappingDirectoryLocations"> <list> <value>WEB-INF/HibernateMappings</value> </list></property>
也可以通过classpath来指出
mappingJarLocations:指定加载的映射文件在jar文件中
<property name="mappingDirectoryLocations"> <list> <value>classpath:/XXX/package/</value> </list></property>
0 0
- Spring 查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocatio
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations配置映射文件时的区别
- hibernate 配置 mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocations 区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- spring配置文件中的mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations 区别
- Spring hibernate配置中mappingLocations、mappingDirectoryLocations与mappingJarLocations 区别
- Spring hibernate配置中mappingLocations、mappingDirectoryLocations与mappingJarLocations 区别
- Spring hibernate配置中mappingLocations、mappingDirectoryLocations与mappingJarLocations 区别
- Spring hibernate配置中mappingLocations、mappingDirectoryLocations与mappingJarLocations ,mappingResource区别
- uboot下init_sequence_f函数之setup_reloc
- Matplotlib直方图和四方图
- poj1716Integer Intervals
- 线程常用的方法
- jQuery Mobile页面加载机制及页面跳转出现的问题
- Spring 查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocatio
- 游戏开发完整学习路线
- thinkphp表单令牌防止重复提交
- 函数的默认实参
- 使用RecyclerView展示瀑布流的效果
- uboot下init_sequence_f函数之copy_uboot_to_ram
- synchronized同步代码块
- Android 内存溢出与内存泄漏的简单分析与解决
- SecureRandom生成“强随机数”用于生成RSA*公钥/私钥*window和linux下不一致的问题