现在的位置: 首页 > 综合 > 正文

SSH配置:hibernate.cfg.xml

2018年08月12日 ⁄ 综合 ⁄ 共 1194字 ⁄ 字号 评论关闭

 近来做了一个小项目,用到了Struts1.x,Spring 2.5和Hibernate3,其中的一些配置文件较为典型,所以拿到这里来和大家分享。

 

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate Configuration DTD 3.0//EN" "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
  3. <hibernate-configuration>
  4.     <session-factory>
  5.         <!-- 配置JDBC连接
  6.         <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
  7.         <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/javapk</property>
  8.         <property name="hibernate.connection.username">root</property>
  9.         <property name="hibernate.connection.password">scorpio</property>
  10.          -->
  11.         <!-- 配置数据源连接 -->
  12.         <property name="hibernate.connection.datasource">jdbc/javapk</property>
  13.         
  14.         <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
  15.         <property name="hibernate.show_sql">true</property>
  16.         <property name="hibernate.hbm2ddl.auto">update</property>
  17.         <mapping resource="org/scorpio/dao/persistence/User.hbm.xml"/>
  18.         <mapping resource="org/scorpio/dao/persistence/Manager.hbm.xml"/>
  19.     </session-factory>
  20. </hibernate-configuration>

 

 

抱歉!评论已关闭.