zoukankan      html  css  js  c++  java
  • LocalSessionFactoryBean有几个属性查找hibernate映射文件

    LocalSessionFactoryBean有几个属性查找hibernate映射文件:

    mappingResources、mappingLocations、mappingDirectoryLocations与mappingJarLocations

    1、String[] mappingResources: 指定classpath下具体映射文件名

     
    1.             <property name="mappingResources">   
    2. <list>   
    3.     <value>cn/itcast/domain/User.hbm.xml</value>   
    4.     <value>cn/itcast/domain/Department.hbm.xml</value>   
    5. </list>   
    6. lt;/property>   

    2、Resource[] mappingLocations:指定任何文件路径,可以指定前缀:classpath、file等

    1. <propertynamepropertyname="mappingLocations"value="/WEB-INF/Pojot.hbm.xml"/>   
    2. <propertynamepropertyname="mappingLocations"value="classpath:cn/itcast/domain/User.hbm.xml"/>  
    3. 也可以用通配符指定,'*'指定一个文件(路径)名,'**'指定多个文件(路径)名,例如:  
    4.         <property name="mappingLocations">  
    5.             <list>  
    6.                 <value>classpath:cn/itcast/domain/*.hbm.xml</value>  
    7.             </list>  
    8.         </property>  

    3、Resource[] mappingDirectoryLocations:指定映射的文件路径

    1. <property name="mappingDirectoryLocations">  
    2.     <list>  
    3.         <value>/WEB-INF/classes/cn/itcast/domain</value>  
    4.     </list>  
    5. </property>  


    4、Resource[] mappingJarLocations:指定加载的映射文件在jar文件

  • 相关阅读:
    vb笔记
    linux学习笔记
    linnux--shell
    # 用类来封装动态数组:分文件编写
    面向对象
    c++2
    c++1
    答疑:指针数组字符串
    文件操作
    用函数封装实现对一个数组增删改查
  • 原文地址:https://www.cnblogs.com/writeLessDoMore/p/6771082.html
Copyright © 2011-2022 走看看