急问,hibernate dialect 问题 百分
我的配置
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password">oldbaby</property>
<property name="hibernate.dialect">
org.hibernate.dialect.MySQLDialect
</property>
<property name="hibernate.connection.url">
jdbc:mysql://127.0.0.1:3306/hisupplier
</property>
<property name="hibernate.connection.driver_class">
org.gjt.mm.mysql.Driver
</property>
<property name="dialect"></property>
<mapping resource="services/Computer.hbm.xml" />
</session-factory>
</hibernate-configuration>
然后库用的是myeclipse自带的hibernate3.1
报
Exception in thread "main"
org.hibernate.HibernateException: Dialect class not found:
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:81)
at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:378)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1881)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1174)
at services.ComputerCreate.main(ComputerCreate.java:15)
错
查了一下
hibernate 3.1 core libraries下
hib ernate3.jar中
org.hibernate.dialect.MySQLDialect和
org.hibernate.dialect.MySQL5Dialect
都存在,为什么会这样
------解决方案--------------------hibernate 的版本问题,版本和对应的dialect的JAR不一致。。
------解决方案--------------------
<property name="dialect"> </property> 是不是这个的原因把这个去了
------解决方案--------------------确保hibernate3.jar处于classpath中
------解决方案--------------------hibernate3.jar 可在你的lib目录下了???
------解决方案--------------------2楼真细心 。。去掉多于的
<property name="dialect"> </property>
试试、、