zoukankan      html  css  js  c++  java
  • mappingResources和mappingLocations区别

    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>

  • 相关阅读:
    CentOS 6.5、6.7 设置静态 ip 教程
    Nagios
    zabbix
    xml 的 <![CDATA["URL"]]>
    Don't make a promise when you are in Joy. Don't reply when you are Sad.Don't take decisions when you are Angry.Think Twice.Act Wise.
    DNS-2
    APM
    Time crumbles things; everything grows old under the power of Time and is forgotten through the lapse of Time
    CentOS 7 配置静态 ip
    AOP
  • 原文地址:https://www.cnblogs.com/feng-jjy/p/9748117.html
Copyright © 2011-2022 走看看