openSession就可以建表 用了三行代碼 這樣合理嗎
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.junit.Test;
public class TestStudents {
???? @Test
???? public void testCreateTable() {
???????? Configuration config = new Configuration().configure();
???????? SessionFactory sessionFactory = config.buildSessionFactory();
???????? Session session = sessionFactory.openSession();
???? }
}
2016-10-30
openSession() 可以的 但是要記得關(guān)閉