日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

hibernate主配置文件的配置

發布時間:2025/3/16 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 hibernate主配置文件的配置 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
1 <?xml version="1.0" encoding="UTF-8"?> 2 <!DOCTYPE hibernate-configuration PUBLIC 3 "-//Hibernate/Hibernate Configuration DTD 3.0//EN" 4 "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> 5 <hibernate-configuration> 6 <session-factory> 7 8 <!-- 9 #hibernate.dialect org.hibernate.dialect.MySQLDialect 10 #hibernate.dialect org.hibernate.dialect.MySQLInnoDBDialect 11 #hibernate.dialect org.hibernate.dialect.MySQLMyISAMDialect 12 #hibernate.connection.driver_class com.mysql.jdbc.Driver 13 #hibernate.connection.url jdbc:mysql:///test 14 #hibernate.connection.username gavin 15 #hibernate.connection.password 16 --> 17 <!-- 數據庫驅動 --> 18 <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property> 19 <!-- 數據庫url --> 20 <property name="hibernate.connection.url">jdbc:mysql:///hibernate_32</property> 21 <!-- 數據庫連接用戶名 --> 22 <property name="hibernate.connection.username">root</property> 23 <!-- 數據庫連接密碼 --> 24 <property name="hibernate.connection.password">1234</property> 25 <!-- 數據庫方言 26 不同的數據庫中,sql語法略有區別. 指定方言可以讓hibernate框架在生成sql語句時.針對數據庫的方言生成. 27 sql99標準: DDL 定義語言 庫表的增刪改查 28 DCL 控制語言 事務 權限 29 DML 操縱語言 增刪改查 30 注意: MYSQL在選擇方言時,請選擇最短的方言. 31 --> 32 <property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 33 34 35 <!-- #hibernate.show_sql true 36 #hibernate.format_sql true 37 --> 38 <!-- 將hibernate生成的sql語句打印到控制臺 --> 39 <property name="hibernate.show_sql">true</property> 40 <!-- 將hibernate生成的sql語句格式化(語法縮進) --> 41 <property name="hibernate.format_sql">true</property> 42 <!-- 43 ## auto schema export 自動導出表結構. 自動建表 44 #hibernate.hbm2ddl.auto create 自動建表.每次框架運行都會創建新的表.以前表將會被覆蓋,表數據會丟失.(開發環境中測試使用) 45 #hibernate.hbm2ddl.auto create-drop 自動建表.每次框架運行結束都會將所有表刪除.(開發環境中測試使用) 46 #hibernate.hbm2ddl.auto update(推薦使用) 自動生成表.如果已經存在不會再生成.如果表有變動.自動更新表(不會刪除任何數據). 47 #hibernate.hbm2ddl.auto validate 校驗.不自動生成表.每次啟動會校驗數據庫中表是否正確.校驗失敗. 48 --> 49 <property name="hibernate.hbm2ddl.auto">update</property> 50 <!-- 引入orm元數據 51 路徑書寫: 填寫src下的路徑 52 --> 53 <!-- 指定hibernate操作數據庫時的隔離級別 54 #hibernate.connection.isolation 1|2|4|8 55 0001 1 讀未提交 56 0010 2 讀已提交 57 0100 4 可重復讀 58 1000 8 串行化 59 --> 60 <property name="hibernate.connection.isolation">4</property> 61 <!-- 指定session與當前線程綁定 --> 62 <property name="hibernate.current_session_context_class">thread</property> 63 64 <mapping resource="cn/itcast/domain/Customer.hbm.xml" /> 65 <mapping resource="cn/itcast/domain/LinkMan.hbm.xml" /> 66 <mapping resource="cn/itcast/domain/Role.hbm.xml" /> 67 <mapping resource="cn/itcast/domain/User.hbm.xml" /> 68 69 </session-factory> 70 </hibernate-configuration>

?

轉載于:https://www.cnblogs.com/houchen/p/10639397.html

總結

以上是生活随笔為你收集整理的hibernate主配置文件的配置的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。