?? test.java
字號:
package com.tarena.ebank.view;
import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import com.tarena.ebank.biz.entriy.Account;
public class Test {
public static void main(String[] args) {
SessionFactory sf =
new Configuration()
.configure()
.buildSessionFactory();
Account act =
new Account("act-0015",6.0);
Session s = sf.openSession();
try {
s.beginTransaction();
s.save(act);
try {
Thread.sleep(10000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
s.getTransaction().commit();
} catch (HibernateException e) {
e.printStackTrace();
s.getTransaction().rollback();
}finally{
s.close();
sf.close();
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -