写hibernate.cfg.xml时报错The content of element type "property" must match "(meta*,(column|formula)*,type?)".

原配置文件是这样的

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC 
    "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
    "http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">

<hibernate-configuration>
    <session-factory>
        <!-- 第一部分:配置数据库信息 -->
        <property name="hibernate.connection.driver_class">
            com.mysql.jdbc.Driver
        </property>
    </session-factory>
</hibernate-configuration>

改成下面这样就可以了。

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

<hibernate-configuration>
    <session-factory>
        <!-- 第一部分:配置数据库信息 -->
        <property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
    </session-factory>
</hibernate-configuration>
    
原文地址:https://www.cnblogs.com/liaoxiaolao/p/9915692.html