2011-05-03 42 views
0

我有與Hibernate的配置有問題,當我運行的類測試affich:JDBC Driver類

creating session factory 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: Hibernate 2.1.6 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: hibernate.properties not found 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Environment <clinit> 
INFO: using CGLIB reflection optimizer 
3 mai 2011 09:47:50 net.sf.hibernate.cfg.Configuration configure 
INFO: configuring from file: hibernate.cfg.xml 
3 mai 2011 09:47:51 net.sf.hibernate.cfg.Configuration addResource 
INFO: Mapping resource: org/domain/projet/config/Employe.hbm.xml 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Binder bindRootClass 
INFO: Mapping class: org.domain.projet.config.Employe -> employe 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration doConfigure 
INFO: Configured SessionFactory: 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing one-to-many association mappings 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing one-to-one association property references 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.Configuration secondPassCompile 
INFO: processing foreign key constraints 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.SettingsFactory buildSettings 
ATTENTION: No dialect set - using GenericDialect: Dialect class not found: org.hibernate.dialect.MySQLDialect 
3 mai 2011 09:47:52 net.sf.hibernate.dialect.Dialect <init> 
INFO: Using dialect: net.sf.hibernate.dialect.GenericDialect 
3 mai 2011 09:47:52 net.sf.hibernate.cfg.SettingsFactory buildSettings 
INFO: Use outer join fetching: true 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
INFO: Using Hibernate built-in connection pool (not for production use!) 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
INFO: Hibernate connection pool size: 1 
JDBC Driver class not found: com.jdbc.mysql.driver 
3 mai 2011 09:47:52 net.sf.hibernate.connection.DriverManagerConnectionProvider configure 
GRAVE: JDBC Driver class not found: com.jdbc.mysql.driver 

回答

4

你在你的classpath需要mysql-connector-*.jar

+0

但我有連接器爲MySQL 5.0,但沒有工作:(我放在Hibernate配置文件中: com.jdbc.mysql.driver user726991 2011-05-03 09:11:24

0

嘗試使用這些屬性值:

<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property> 
... 
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property> 

檢查hibernate3.jar是否也在您的路徑中。

+0

謝謝,我發現錯誤是net.fr.hibernate.dialect.MYSQLDialect :) – user726991 2011-05-03 10:12:20

0
JDBC Driver class not found: com.jdbc.mysql.driver

全限定類名是區分大小寫的。您需要在您的Hibernate配置文件中聲明com.mysql.jdbc.Driver大寫D,而不是com.mysql.jdbc.driver小寫d