这是我的代码。当我一次执行时它会给出以下错误。 初始SessionFactory创建failed.org.hibernate.HibernateException:找不到Dialect类:org.hibernate.dialect.MySQL5InnoDBDialectt
package com.bis.stock;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
public class HibernateUtil {
private static SessionFactory sessionFactory = buildSessionFactory();
private static SessionFactory buildSessionFactory() {
try {
//Create the SessionFactory from hibernate.cfg.xml
sessionFactory = new Configuration().configure("hibernate/Hibernate.cfg.xml").buildSessionFactory();
return new Configuration()
.configure()
.buildSessionFactory();
} catch (Throwable ex) {
System.err.println("Initial SessionFactory creation failed." + ex);
throw new ExceptionInInitializerError(ex);
}
}
public static SessionFactory getSessionFactory() {
return sessionFactory;
}
}
答案 0 :(得分:0)
尝试
org.hibernate.dialect.MySQL5InnoDBDialect
而不是
org.hibernate.dialect.MySQL5InnoDBDialectt