Hibernate主設定檔屬性,

來源:互聯網
上載者:User

Hibernate主設定檔屬性,

show_sql其值為TRUE或FALSE

表示是否顯示執行的SQL語句

format_sql其值為TRUE或FALSE

表示是否格式化執行的SQL語句

 hbm2ddl其值即表示內容如下

create----先刪除,在建立相應的資料庫表

update----如果表不存在就建立表,不一樣就更新,一樣就什麼都不做

create-drop----初始化時建立表,SessionFactory執行close()時刪除表。

validate----驗證表結構是否一致,如果不一致就拋異常

下面是一些常用資料庫連接配置

 MySQL

hibernate.dialect org.hibernate.dialect.MySQLDialect
hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect
hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect
hibernate.connection.driver_class com.mysql.jdbc.Driver
hibernate.connection.url jdbc:mysql:///test
hibernate.connection.username gavin
hibernate.connection.password


Oracle

hibernate.dialect org.hibernate.dialect.Oracle8iDialect
hibernate.dialect org.hibernate.dialect.Oracle9iDialect
hibernate.dialect org.hibernate.dialect.Oracle10gDialect
hibernate.connection.driver_class oracle.jdbc.driver.OracleDriver
hibernate.connection.username ora
hibernate.connection.password ora
hibernate.connection.url jdbc:oracle:thin:@localhost:1521:orcl
hibernate.connection.url jdbc:oracle:thin:@localhost:1522:XE

 DB2

hibernate.dialect org.hibernate.dialect.DB2Dialect
hibernate.connection.driver_class com.ibm.db2.jcc.DB2Driver
hibernate.connection.driver_class COM.ibm.db2.jdbc.app.DB2Driver
hibernate.connection.url jdbc:db2://localhost:50000/somename
hibernate.connection.url jdbc:db2:somename
hibernate.connection.username db2
hibernate.connection.password db2

 

 




相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.