hibernate 配置 mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
来源:互联网 发布:linux 安装hadoop 编辑:程序博客网 时间:2024/06/05 10:35
mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
他们的区别:
1. mappingResources:指定classpath下具体映射文件名
<property name="mappingResources">
<value>petclinic.hbm.xml </value>
</property>
2. mappingLocations:可以指定任何文件路径,并且可以指定前缀:classpath、file等
<property name="mappingLocations">
<value>/WEB-INF/petclinic.hbm.xml </value>
</property>
<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包下任何maps路径下的hbm.xml文件都被加载为映射文件
3. mappingDirectoryLocations:指定映射的文件路径
<property name="mappingDirectoryLocations"> <list>
<value>WEB-INF/HibernateMappings</value>
</list>
</property>
也可以通过classpath来指出
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/XXX/package/</value>
</list>
</property>
在我项目中采用
<property name="mappingDirectoryLocations">
<list>
<value>classpath:/XXX/package/</value>
</list>
</property>
在结果会报 UserModel is not mapper 没有找到映射文件
所以我做了一下修改 classpath*
<property name="mappingDirectoryLocations">
<list>
<value>classpath*:/conf/hibernate/</value>
</list>
</property>
- 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区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations 区别
- mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations配置映射文件时的区别
- mappingDirectoryLocations/mappingJarLocations/mappingResources/mappingLocations的区别
- 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区别
- maven的配置和使用
- 习题2-9 分数化小数
- esapi api
- 一次使用iis6+cobaltstrike提权
- solr4.4在windows7安装
- hibernate 配置 mappingResources、mappingLocations、mappingDirectoryLocations、mappingJarLocations
- CVTE 嵌入式软件工程师 二面
- TCP校验和的原理和实现
- 电脑蓝屏故障的原因以及解决方法
- JQuery上传插件Uploadify详解及其中文按钮解决方案
- iOS 数据持久化之使用NSUserDefaults存储数据
- .NET 页面间传值的几种方法
- 无向图求桥 hdu4738 Caocao's Bridges
- MSN和QQ文件传输速度解析