天天看點

hibernate.cfg.xml執行個體

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE hibernate-configuration PUBLIC

    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"

    "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd">

//以上内容通用

<hibernate-configuration>

    <session-factory>

        <!-- 資料庫連接配接 -->

        <property name="connection.driver_class">

            oracle.jdbc.OracleDriver

        </property>

        <property name="connection.url">

            jdbc:oracle:thin:@localhost:1521:orcl

        </property>

        <property name="connection.username">scott</property>

        <property name="connection.password">tiger</property>

        <!-- 輔助參數 -->

        <property name="dialect">

            org.hibernate.dialect.Oracle10gDialect

        </property>

        <property name="show_sql">true</property>

        <property name="format_sql">true</property>

        <property name="current_session_context_class">thread</property>

        <!-- 映射資訊 ,指明該類的xml檔案位置,包名+xml檔案名-->

        <mapping resource="po/User.hbm.xml"/>

        <mapping resource="po/District.hbm.xml"/>

        <!-- <mapping resource="po/House.hbm.xml"/> -->

        <!-- <mapping resource="po/Street.hbm.xml"/>  -->

    </session-factory>

</hibernate-configuration>

繼續閱讀