Hibernate配置

来源:互联网 发布:整型数据占几个字节 编辑:程序博客网 时间:2024/06/07 09:34
<?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"> 

 <hibernate-configuration>
    
     <!--session-factory>
         <property name="hibernate.connection.driver_class">
             oracle.jdbc.driver.OracleDriver
         </property>
         <property name="hibernate.connection.url">
             jdbc:oracle:thin:@192.168.0.150:1521:orcl
         </property>
         <property name="hibernate.connection.username">
          oaec
         </property>
         <property name="hibernate.connection.password">
            oaec
         </property>
         <property name="hibernate.dialect">
         org.hibernate.dialect.Oracle10gDialect
        </property>
        <property name="hibernate.dialect">
         org.hibernate.dialect.HSQLDialect
        </property>
         <mapping resource="com/oracleoaec/hibernate/User.hbm.xml" />
        
     </session-factory-->
    
    
     <session-factory> 
    
  <property name="hibernate.show_sql">true</property> 
  <property name="hibernate.format_sql">true</property>
    
        <!-- mysql数据库驱动 --> 
        <property name="hibernate.connection.driver_class">
         com.mysql.jdbc.Driver
        </property> 
        <!-- mysql数据库名称 --> 
        <property name="hibernate.connection.url">
         jdbc:mysql://localhost:3306/flight
        </property> 
        <!-- 数据库的登陆用户名 --> 
        <property name="hibernate.connection.username">
         root
        </property> 
        <!-- 数据库的登陆密码 --> 
        <property name="hibernate.connection.password"></property> 
        <!-- 方言:为每一种数据库提供适配器,方便转换 --> 
        <property name="hibernate.dialect">
         org.hibernate.dialect.MySQLDialect
        </property> 
         
        <mapping resource="com/oracleoaec/hibernate/User.hbm.xml"/>
    </session-factory>
    
 </hibernate-configuration>
原创粉丝点击