spring配置文件-------通配符

<!-- 这里一定要注意是使用spring的mappingLocations属性进行通配的 -->
      <property name="mappingLocations">
         <list>
            <value>classpath:/com/model/domain/*.hbm.xml</value>

         </list>
      </property>

----------------------------------------------------------------------------------------------------------------------------------(割割更健康)

spring整合hibernate配置文件中的sessionfactory中,配置映射文件有好多种方法:

LocalSessionFactoryBean有好几个属性用来查找hibernate映射文件:mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocations。

他们的区别:
mappingResources:指定classpath下具体映射文件名
<property name="mappingResources">
  <value>petclinic.hbm.xml</value>
</property>


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/domain/**/maps/*.hbm.xml</value>
</property>
上面的配置是在com/company/domain包下任何maps路径下的hbm.xml文件都被加载为映射文件mappingDirectoryLocations:指定映射的文件路径
mappingJarLocations:指定加载的映射文件在jar文件中

 注意:当有mappingLocations存在时,mappingResources中对hibernate映射文件的配置是不加载的,因此,需要把映射文件配置都放到mappingLocations中

转载于:https://www.cnblogs.com/wuyulunbi/archive/2012/12/28/spring_1.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/274403.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

若川知乎问答:2年前端经验,做的项目没什么技术含量,怎么办?

知乎问答&#xff1a;做了两年前端开发&#xff0c;平时就是拿 Vue 写写页面和组件&#xff0c;简历的项目经历应该怎么写得好看&#xff1f;以下是我的回答&#xff0c;阅读量5000&#xff0c;所以发布到公众号申明原创。题主说的2年经验做的东西没什么技术含量&#xff0c;应…

ui设计基础_我不知道的UI设计的9个重要基础

ui设计基础重点 (Top highlight)After listening to Craig Federighi’s talk on how to be a better software engineer I was sold on the idea that it is super important for a software engineer to learn the basic principles of software design.听了克雷格费德里希(C…

Ubuntu下修改file descriptor

要修改Ubuntu下的file descriptor的话&#xff0c;请参照一下步骤。&#xff08;1&#xff09;修改limits.conf  $sudo vi /etc/security/limits.conf  增加一行  *  -  nofile  10000&#xff08;2&#xff09;修改 common-session  $ sudo vi/etc/pam.d/common…

C# 多线程控制 通讯 和切换

一.多线程的概念   Windows是一个多任务的系统&#xff0c;如果你使用的是windows 2000及其以上版本&#xff0c;你可以通过任务管理器查看当前系统运行的程序和进程。什么是进程呢&#xff1f;当一个程序开始运行时&#xff0c;它就是一个进程&#xff0c;进程所指包括运行中…

vue路由匹配实现包容性_包容性设计:面向老年用户的数字平等

vue路由匹配实现包容性In Covid world, a lot of older users are getting online for the first time or using technology more than they previously had. For some, help may be needed.在Covid世界中&#xff0c;许多年长用户首次上网或使用的技术比以前更多。 对于某些人…

IPhone开发 用子类搞定不同的设备(iphone和ipad)

用子类搞定不同的设备 因为要判断我们的程序正运行在哪个设备上&#xff0c;所以&#xff0c;我们的代码有些混乱了&#xff0c;IF来ELSE去的&#xff0c;记住&#xff0c;将来你花在维护代码上的时间要比花在写代码上的时间多&#xff0c;如果你的项目比较大&#xff0c;且IF语…

见证开户_见证中的发现

见证开户Each time we pick up a new video game, we’re faced with the same dilemma: “How do I play this game?” Most games now feature tutorials, which can range from the innocuous — gently introducing each mechanic at a time through natural gameplay — …

使用JXL组件操作Excel和导出文件

使用JXL组件操作Excel和导出文件 原文链接&#xff1a;http://tianweili.github.io/blog/2015/01/29/use-jxl-produce-excel/ 前言&#xff1a;这段时间参与的项目要求做几张Excel报表&#xff0c;由于项目框架使用了jxl组件&#xff0c;所以把jxl组件的详细用法归纳总结一下。…

facebook有哪些信息_关于Facebook表情表情符号的所有信息

facebook有哪些信息Ever since worldwide lockdown and restriction on travel have been imposed, platforms like #Facebook, #Instagram, #Zoom, #GoogleDuo, & #Whatsapp have become more important than ever to connect with your loved ones (apart from the sourc…

M2总结报告

团队成员 李嘉良 http://home.cnblogs.com/u/daisuke/ 王熹 http://home.cnblogs.com/u/vvnx/ 王冬 http://home.cnblogs.com/u/darewin/ 王泓洋 http://home.cnblogs.com/u/fiverice/ 刘明 http://home.cnblogs.com/u/liumingbuaa/ 由之望 http://www.cnbl…

react动画库_React 2020动画库

react动画库Animations are important in instances like page transitions, scroll events, entering and exiting components, and events that the user should be alerted to.动画在诸如页面过渡&#xff0c;滚动事件&#xff0c;进入和退出组件以及应提醒用户的事件之类的…

Weather

public class WeatherModel { #region 定义成员变量 private string _temperature ""; private string _weather ""; private string _wind ""; private string _city ""; private …

线框模型_进行计划之前:线框和模型

线框模型Before we start developing something, we need a plan about what we’re doing and what is the expected result from the project. Same as developing a website, we need to create a mockup before we start developing (coding) because it will cost so much…

撰写论文时word使用技巧(转)

------------------------------------- 1. Word2007 的表格自定义格式额度功能是很实用的&#xff0c;比如论文中需要经常插入表格的话&#xff0c; 可以在“表格设计”那里“修改表格样式”一次性把默认的表格样式设置为三线表&#xff0c;这样&#xff0c; 你以后每次插入的…

工作经验教训_在设计工作五年后获得的经验教训

工作经验教训This June it has been five years since I graduated from college. Since then I’ve been working as a UX designer for a lot of different companies, including a start-up, an application developer, and two consultancy firms.我从大学毕业已经五年了&a…

Wayland 源码解析之代码结构

来源&#xff1a;http://blog.csdn.net/basilc/article/details/8074895 获取、编译 Wayland 及其依赖库可参考 Wayland 官方网站的 Build 指南&#xff1a;http://wayland.freedesktop.org/building.html。 Wayland 实现的代码组成可以分成以下四部分&#xff1a; 1. Wayland…

中文排版规则_非设计师的5条排版规则

中文排版规则01仅以一种字体开始 (01 Start with only one font) The first tip for non-designers dealing with typography is simple and will make your life much easier: Stop combining different fonts you like individually and try using only one font in your fut…

基本响应性的Web设计测试工具

在重新设计页面的过程中。要使页面完全响应的设计&#xff08;这意味着它会重新调整大小根据浏览器的尺寸和方向&#xff09;。如iPhone和iPad的移动电话和平板电脑我碰到了一些非常方便的响应设计工具&#xff0c;帮我测试网站在不同的屏幕响应。下面的这些响应的网页设计工具…

ux设计_声音建议:设计UX声音的快速指南

ux设计Mating calls, warning grunts, and supportive coos are some of the sounds heard throughout the animal kingdom. All species use finely-tuned noises to communicate to one another and inform others of an action or behavior. We humans aren’t all that dif…

css3高级和低级样式属性先后顺序

写css hack 时&#xff0c;由于hack主要针对的是个别浏览器&#xff0c;hack的书写顺序应当是从一般到特殊的写法。 如&#xff1a; .box { width:200px; height:200px; position:fixed; left:0; top:0; _position:absolute; } 如果颠倒顺序&#xff0c;从特殊到一般&#xff0…