zoukankan      html  css  js  c++  java
  • hibernate中出现 文档根元素 "hibernate-mapping" 必须匹配 DOCTYPE 根 "hibernate-configuration"

    hibernate中出现 文档根元素 "hibernate-mapping" 必须匹配 DOCTYPE 根 "hibernate-configuration" 错误!

    网上查资料发现这是因为hibernate.xml和我的customer.hbm.xml中的表头原因 这两个的表头不是一样的,

    有细微差别

    这是hibernate.xml

    <?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="dialect">
                org.hibernate.dialect.MySQLDialect
            </property>
            <property name="connection.driver_class">com.mysql.jdbc.Driver</property>
            <property name="connection.url">jdbc:mysql://localhost:3306/test</property>
            <property name="connection.username">root</property>
            <property name="connection.password">java</property>
            <property name="show_sql">true</property>
            <property name="hbm2ddl.auto">update</property>
            <mapping resource="com/Customer.hbm.xml"></mapping>
        </session-factory>
    </hibernate-configuration>

    这里是customer.hbm.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE hibernate-mapping PUBLIC
     "-//Hibernate/Hibernate Mapping DTD//EN"
     "http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd" >
    
    <hibernate-mapping package="com">
        <class name="Customer" table="CUSTOMER">
            <id name="id" column="ID">
                <generator class="native"></generator>
            </id>
            <property name="username" column="USERNAME" type="string"
                not-null="true" />
            <property name="password" column="PASSWORD" type="string"
                not-null="true" />
            <property name="realname" column="REALNAME" type="string" />
            <property name="address" column="ADDRESS" type="string"  />
            <property name="mobile" column="MOBILE" type="string" />
    
        </class>
    
    </hibernate-mapping>
  • 相关阅读:
    用torchvision.datasets.ImageFolder加载图片数据集
    Python-使用requests库和正则表达式爬取淘宝商品信息
    Item-CF和User-CF算法训练过程优化的心得
    在docker上部署springboot项目
    在Spring Boot 上配置Redis Cluster出现的异常
    Docker Redis5.0 集群搭建
    blade and soul factions
    Traveling in Blade & Soul
    what is blade and soul Soul Shields
    how to get soul shields in blade and soul
  • 原文地址:https://www.cnblogs.com/liushao/p/6358590.html
Copyright © 2011-2022 走看看