日期:2014-05-19  浏览次数:20701 次

org.hibernate.HibernateException: Hibernate Dialect must be explicitly set
我用的是properties方式配置文件,请问这个错误是什么原因,谢谢各位
org.hibernate.HibernateException:   Hibernate   Dialect   must   be   explicitly   set
at   org.hibernate.dialect.DialectFactory.determineDialect(DialectFactory.java:57)
at   org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:39)
at   org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:422)
at   org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:128)
at   org.hibernate.cfg.Configuration.buildSettings(Configuration.java:2009)
at   org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1292)
at   cn.com.cnsc.app.MyFileApplication. <clinit> (MyFileApplication.java:108)

------解决方案--------------------
没有设置方言,hibernate.cfg.xml里面加上
<property name= "hibernate.dialect "> net.sf.hibernate.dialect.MySQLDialect </property>
net.sf.hibernate.dialect.MySQLDialect改成你自己的数据库的方言类,hibernate提供的