至高吴上(Alfa.wu)

一个人,一生,能坚持做好一件事情是多么的牛XX啊!!!

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

NHibernate的hbm.xml的配置文件大全

 

摘自: http://blog.csdn.net/jackxinxu2100/article/details/6617841

 

NHibernate的hbm.xml的配置文件大全:

*************************************************************************************************************************************

sql2000/2005.hbm.xml

<?xml version="1.0" ?>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory>

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="dialect">NHibernate.Dialect.MsSql2000Dialect/MsSql2005Dialect</property>

<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>

<property name="connection.connection_string">Server=(local);Initial Catalog=dbname;User Id=user;Password=********</property>

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

Mysql.hbm.xml

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

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory name="NHibernate.Test">

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.MySqlDataDriver</property>

<property name="connection.connection_string">

Database=test;Data Source=someip;User Id=blah;Password=blah

</property>

<property name="dialect">NHibernate.Dialect.MySQLDialect</property>

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

Access.hbm.xml

<?xml version="1.0" ?>

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory>

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="dialect">NHibernate.JetDriver.JetDialect, NHibernate.JetDriver</property>

<property name="connection.driver_class">NHibernate.JetDriver.JetDriver, NHibernate.JetDriver</property>

<property name="connection.connection_string">Provider=Microsoft.Jet.OLEDB.4.0;Data Source=YourDatabaseFilePathHere.mdb</property>

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

Oracle.hbm.xml

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

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2">

<session-factory>

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.OracleDataClientDriver</property>

<property name="connection.connection_string">User ID=id;Password=pw;Data Source=requ;Pooling=true;Connection Lifetime=180;Connection Timeout=30;Min Pool Size=2;Max Pool Size=10;Incr Pool Size=2;</property>

<property name="dialect">NHibernate.Dialect.Oracle10gDialect/Oracle9iDialect </property>

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

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

Firebird.hbm.xml

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory name="NHibernate.Test">

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.FirebirdClientDriver</property>

<property name="connection.isolation">ReadCommitted</property>

<property name="connection.connection_string">

Server=localhost;

Database=C:\nhibernate.fdb;

User=SYSDBA;Password=masterkey

</property>

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

<property name="dialect">NHibernate.Dialect.FirebirdDialect</property>

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

<property name="command_timeout">444</property>

<property name="query.substitutions">true 1, false 0, yes 1, no 0</property>

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

Postgrel.hbm.xml

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

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory name="NHibernate.Test">

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.NpgsqlDriver</property>

<property name="connection.connection_string">

Server=localhost;initial catalog=nhibernate;User ID=nhibernate;Password=********;

</property>

<property name="dialect">NHibernate.Dialect.PostgreSQLDialect</property>

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

DB2.hbm.xml

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

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.0" >

<session-factory name="session">

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.OdbcDriver</property>

<property name="connection.connection_string">driver={IBM DB2 ODBC DRIVER};Database=db;hostname=host;port=port;protocol=TCPIP; uid=uid; pwd=pwd</property>

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

<property name="dialect">NHibernate.Dialect.DB2Dialect</property>

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

<mapping resource="..." />

</session-factory>

</hibernate-configuration>

*************************************************************************************************************************************

*************************************************************************************************************************************

SQLite.hbm.xml

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

<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >

<session-factory name="NHibernate.Test">

<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>

<property name="connection.driver_class">NHibernate.Driver.SQLiteDriver</property>

<property name="connection.connection_string">

Data Source=nhibernate.db;Version=3

</property>

<property name="dialect">NHibernate.Dialect.SQLiteDialect</property>

<property name="query.substitutions">true=1;false=0</property>

</session-factory>

</hibernate-configuration>

posted on 2013-03-02 11:16  Alfa  阅读(341)  评论(0编辑  收藏  举报