异常是这样
org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
正确写法:
public void save(Login login) {
Configuration config = new Configuration();
SessionFactory sf=config.configure().buildSessionFactory(); Session s=sf.openSession();
Transaction t =s.beginTransaction();
s.save(login);
t.commit();
s.close();
}
错误写法:
public void save(Login login) {
Configuration config = new Configuration();
SessionFactory sf=config.buildSessionFactory(); Session s=sf.openSession();
Transaction t =s.beginTransaction();
s.save(login);
t.commit();
s.close();
}
原文引用地址:很抱歉,记不得了。