@Test
public void testLoad() {
Session session = sessionFactory.getCurrentSession();
session.beginTransaction();
Teacher t = (Teacher)session.load(Teacher.class, 1);//生成的是一个代理对象,没有发出sql语句,只有在使用的时候才会发sql
session.getTransaction().commit();
System.out.println(t.getClass());
//System.out.println(t.getName());
}
public void testGet() {
Teacher t = (Teacher)session.get(Teacher.class, 1);//直接发送sql语句,生成的是该类的对象