【问题标题】:Dialect class not found. \when using hibernate找不到方言类。 \当使用休眠
【发布时间】:2014-04-25 13:16:50
【问题描述】:

这是我的代码。当我一次执行时,它会给出以下错误。 初始 SessionFactory 创建 failed.org.hibernate.HibernateException:未找到方言类: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;
    }

}

【问题讨论】:

  • 不确定是否是您的拼写错误,但您在MySQL5InnoDBDialectt 末尾有一个额外的t
  • 确保 org.hibernate.dialect.MySQL5InnoDBDialect 存在于您的 Hibernate.cfg.xml 文件中。还要检查@peeskillet 提到的错字。

标签: java eclipse hibernate


【解决方案1】:

试试

org.hibernate.dialect.MySQL5InnoDBDialect

而不是

org.hibernate.dialect.MySQL5InnoDBDialectt

【讨论】:

    猜你喜欢
    • 2022-11-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-12
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多