寫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>
    

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM