hibernate在配置文件中配置多个的问题,请熟悉的知晓一声

qqqwwwqw 2007-11-20 10:29:44
下面的是我的配置文件
  <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

<!-- Generated file - Do not edit! -->

<hibernate-configuration>

<!-- a SessionFactory instance listed as /jndi/name -->
<session-factory>

<!-- properties -->
<property name="dialect">org.hibernate.dialect.SQLServerDialect</property>
<property name="show_sql">true</property>
<property name="connection.username">sa</property>
<property name="connection.password">123</property>
<property name="connection.driver_class">com.microsoft.jdbc.sqlserver.SQLServerDriver</property>
<property name="connection.url">jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=sql</property>

<!-- mapping files
<mapping resource="hibernate/second/Cource.hbm.xml"/>
<mapping resource="hibernate/second/CourcetecherConnection.hbm.xml"/>
<mapping resource="hibernate/second/SamDataauthconfig.hbm.xml"/>
<mapping resource="hibernate/second/SamRole.hbm.xml"/>
<mapping resource="hibernate/second/SamRolesfuncrel.hbm.xml"/>
<mapping resource="hibernate/second/SamUser2usegrouprel.hbm.xml"/>
<mapping resource="hibernate/second/SamUsergroup2rel.hbm.xml"/>
<mapping resource="hibernate/second/SamUsergroup.hbm.xml"/>
<mapping resource="hibernate/second/Student.hbm.xml"/>
<mapping resource="hibernate/second/StudentcourceConnection.hbm.xml"/>
<mapping resource="hibernate/second/StudenttecherConnection.hbm.xml"/>
<mapping resource="hibernate/second/Techer.hbm.xml"/>
<mapping resource="hibernate/second/TecherclassConnection.hbm.xml"/>
<mapping resource="hibernate/second/Tuser.hbm.xml"/>
-->



</session-factory>

</hibernate-configuration>


现在的问题是我想把这些配置文件打包成一个jar文件,现在怎么在配置文件中引入这个jar文件,从而来用这
些配置文件,因为数据库大了不可能写这么多<mapping resource />啊,
请指教
...全文
1339 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
zuguanqun 2007-11-21
  • 打赏
  • 举报
回复
那就分模块放吧比如:
你可以把和用户有关的都放到user.hbm.xml里面去
<mapping resource="schema/user.hbm.xml"/>

在user.hbm.xml里面在放多个具体的表
<hibernate-mapping package="">
<class name="User"/>
</class>
<class name="UserGroup"/>
</class>
......

</hibernate-mapping>

ltl215 2007-11-21
  • 打赏
  • 举报
回复
<property name= "mappingList ">
<list>
<value> [相对路径]/*.hbm.xml </value>
</list>
</property>

62,623

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧