-
hibernate基本類型查看全部
-
單一主鍵 (1)assigned 由java應用程序負責生成(手工賦值) (2)native 由底層數據庫自動生成標示符,如果是MySQL就是increment,如果是Oracle就是sequence,等等查看全部
-
hibernate中<id>標簽主鍵生成策略查看全部
-
hbm配置文件常用設置<id>標簽查看全部
-
hbm配置文件常用設置<class>標簽查看全部
-
hbm配置文件常用設置<hibernate-mapping>查看全部
-
openSession與getCurrentSession的區別查看全部
-
獲得sessioin對象的方法: 1:openSession() 2:getCurrentSession() 如果使用getCurrentSession需要在hibernate.cfg.xml文件中進行配置 本地事務(jdbc事務) <property name="hibernate.current_session_context_class">thread</property> 全局事務(jta事務) <property name="hibernate.current_session_context_class">jta</property>查看全部
-
不使用事務的自動提交方式,記得用session.flush()來輸出sql語句,否則添加不成功查看全部
-
1.不建議直接使用jdbc的connection操作數據庫,而是通過session操作數據庫。 2.session可以了解為操作數據庫的對象,操作數據庫之前必須先獲取session的實例 3.session與connection,是多對一關系,每個session都有一個與之對應的connection,一個connection不同時刻可以供多個session使用。 4.把對象保存到關系數據庫中需要調用session的各種方法:save(),update(),delete(),createQuery查看全部
-
hibernate的執行流程查看全部
-
hibernate.cfg.xml常用配置查看全部
-
通過hibernate API編寫訪問數據庫的代碼 1、Configuration config=new Configuration().configure();//創建配置對象 2、ServiceRegisty sericeRegistry=new ServiceRegistyBuilder().applySettings(config.getProperties()).buildServiceRegistry()//創建服務注冊對象 3、sessionFactory config.buildSessionFactory(serviceRegistry);//創建會話工廠對象 4.session=sessionFactory.openSesson();//打開會話 5、transaction=session。beginTransaction();//打開事物查看全部
-
使用 junit 測試: @Test 測試注釋標簽 @Before 初始化方法 @After 釋放資源 執行順序: (1)Before(2)Test(3)After查看全部
-
hibernate.cfg.xml加載持久化文件<mapping resource="STudent.hbm.xml"/>查看全部
舉報
0/150
提交
取消