使用休眠模式运行更新数据库时出现以下错误

时间:2019-05-29 16:29:02

标签: hibernate-mapping

出现以下错误:

  

org.hibernate.HibernateException:当未设置“ hibernate.dialect”时,对DialectResolutionInfo的访问不能为空

这是我的hibernate.cfg.xml文件

   <?xml version="1.0" encoding="UTF-8"?>
   <!DOCTYPE hibernate-configuration PUBLIC "-//Hibernate/Hibernate 
    Configuration DTD 5.3//EN" 
   "http://hibernate.sourceforge.net/hibernate-configuration-5.3.dtd">

  <hibernate-configuration>
  <session-factory>
    <property name="hbm2ddl.auto">update</property>
    <property 
   name="dialect">org.hibernate.dialect.MySQLDialect</property>
    <property 
 name="connection.url">jdbc:mysql://localhost:3306/test123</property>
    <property name="connection.username">root</property>
    <property name="connection.password">root</property>
    <property 
name="connection.driver_class">com.mysql.jdbc.Driver</property>
    <mapping class="com.test.Employee" />
</session-factory>
</hibernate-configuration>

employee.hbm.xml文件具有以下信息:

<hibernate-mapping>
<class name="com.test.Employee" table="employee">
    <id name="id">
        <generator class="assigned"></generator>
    </id>
    <property name="firstName"></property>
    <property name="lastName"></property>
</class>
</hibernate-mapping>

我已经验证了数据库凭据,没关系

0 个答案:

没有答案