libs:
代码:
package com.hibernate.demo.po;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
public class TestEvents {
private static SessionFactory sf = null;
@BeforeClass
public static void beforeClass(){
sf = new AnnotationConfiguration().configure().buildSessionFactory();
}
@Test
public void testLoad(){
Session session = sf.openSession();
session.beginTransaction();
Object obj = session.load(Event.class,new Long(1));
System.out.println(obj);
}
@AfterClass
public static void afterClass(){
sf.close();
}
}