我在运行类测试时遇到了hibernate的配置问题:
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
答案 0 :(得分:4)
你的课程路径上需要mysql-connector-*.jar
答案 1 :(得分:0)
尝试使用这些属性值:
<property name="hibernate.dialect">org.hibernate.dialect.MySQLDialect</property>
...
<property name="hibernate.query.factory_class">org.hibernate.hql.classic.ClassicQueryTranslatorFactory</property>
检查hibernate3.jar是否也在您的路径中。
答案 2 :(得分:0)
JDBC Driver class not found: com.jdbc.mysql.driver
完全限定类名称区分大小写。您需要在Hibernate配置文件中使用大写com.mysql.jdbc.Driver
声明D
,而不是com.mysql.jdbc.driver
使用小写d
。