?? test1.java
字號:
package test.general.demo;
import org.hibernate.Session;
import org.hibernate.Transaction;
import test.general.pojo.Empl;
import test.general.pojo.HourlyEmpl;
import test.general.pojo.SalariedEmpl;
import test.general.sf.HibernateSessionFactory;
public class Test1 {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Empl Tom,Mike,Jack,Linda;
Tom = new HourlyEmpl(100);
Tom.setName("Tom");
Mike = new HourlyEmpl(200);
Mike.setName("Mike");
Jack=new SalariedEmpl(5000);
Jack.setName("Jack");
Linda=new SalariedEmpl(6000);
Linda.setName("Linda");
Session session=HibernateSessionFactory.getSession();
Transaction tx=session.beginTransaction();
session.save(Tom);
session.save(Mike);
session.save(Jack);
session.save(Linda);
tx.commit();
session.close();
}
}
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -