[求助]使用hibernate与mysql结合的请帮一下忙! _MySQL, Oracle及数据库讨论区_Weblogic技术|Tuxedo技术|中间件技术|Oracle论坛|JAVA论坛|Linux/Unix技术|hadoop论坛_联动北方技术论坛  
网站首页 | 关于我们 | 服务中心 | 经验交流 | 公司荣誉 | 成功案例 | 合作伙伴 | 联系我们 |
联动北方-国内领先的云技术服务提供商
»  游客             当前位置:  论坛首页 »  自由讨论区 »  MySQL, Oracle及数据库讨论区 »
总帖数
1
每页帖数
101/1页1
返回列表
0
发起投票  发起投票 发新帖子
查看: 1891 | 回复: 0   主题: [求助]使用hibernate与mysql结合的请帮一下忙!         下一篇 
felix
注册用户
等级:新兵
经验:6
发帖:56
精华:0
注册:2011-7-22
状态:离线
发送短消息息给felix 加好友    发送短消息息给felix 发消息
发表于: IP:您无权察看 2014-12-17 10:49:37 | [全部帖] [楼主帖] 楼主

我过去用的是sql server 2000与hibernate结合.
现在改用mysql 与hibernate结合后配制hibernate.cfg.xml出现异常:

org.hibernate.HibernateException: Dialect class not found: net.sf.hibernate.dialect.MySQLDialect
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:374)
at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:110)
at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1463)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1004)
at mysql.MySqlSession.initFactory(MySqlSession.java:5
at mysql.test.MySQLFirstTest.setUp(MySQLFirstTest.java:1
at junit.framework.TestCase.runBare(TestCase.java:125)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:11
at junit.framework.TestSuite.runTest(TestSuite.java:20
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:47
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)


mysql的hibernate.cfg.xml配制如下:

<?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">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">
org.gjt.mm.mysql.Driver
</property>
<property name="hibernate.connection.url">jdbc:myserver://localhost:3306;DatabaseName=shitest</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="dialect">net.sf.hibernate.dialect.MySQLDialect</property>
<!-- property name="hibernate.connection.pool_size"></property -->
<!-- show sql log for debug -->
<property name="hibernate.show_sql">true</property>
<!-- use database out join -->
<property name="hibernate.use_outer_join">true</property>
<!-- type of transaction management -->
<property name="hibernate.transaction.factory_class">
net.sf.hibernate.transaction.JDBCTransactionFactory
</property>
<!-- pojo hbm mapping start -->
<mapping resource="mysql/po/MyFirstTest.hbm.xml"/>
<!-- pojo hbm mapping end -->
</session-factory>
</hibernate-configuration>


我在JSP页面直接访问mysql已没有问题了的.

根据异常说dialect的配制找不到.

请问我那差什么没有配制呢?

网上找了一下,也没有找到.

请知道帮忙一下.

先多谢了.

--转自 北京联动北方科技有限公司




赞(0)    操作        顶端 
总帖数
1
每页帖数
101/1页1
返回列表
发新帖子
请输入验证码: 点击刷新验证码
您需要登录后才可以回帖 登录 | 注册
技术讨论