小编Aqi*_*mid的帖子

hibernate.cfg.xml包含有关MySQL数据库的信息,为什么我会收到此异常?

这是关于java hibernate的问题.

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.dialect">org.hibernate.dialect.MySQLDialect</property>
    <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    <property name="hibernate.connection.url">jdbc:mysql://localhost:3306/poc</property>
    <property name="hibernate.connection.username">user</property>
    <property name="hibernate.connection.password"/>
    <mapping class="test.person" file="" jar="" package="" resource="person.hbm.xml"/>
  </session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)

与数据库的连接正常,我可以探索数据库和表,

我的样本

person.hbm.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-mapping>
    <class name="test.person" table="person">
        <id name="id" type="int" column="id" >
            <generator class="assigned"/>
        </id>
        <property name="fName">
            <column name="fName" />
        </property>
        <property name="lName">
            <column name="lName"/>
        </property>
        <property name="age">
            <column name="age"/>
        </property>
        <property …
Run Code Online (Sandbox Code Playgroud)

java mysql hibernate

8
推荐指数
1
解决办法
8万
查看次数

标签 统计

hibernate ×1

java ×1

mysql ×1