网上查资料发现这是因为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>

 

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

有细微差别

 

这是hibernate.xml

相关文章:

  • 2021-10-05
  • 2022-12-23
  • 2021-11-26
  • 2022-12-23
  • 2022-01-12
  • 2022-12-23
  • 2021-07-27
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-11-19
  • 2021-11-22
  • 2021-08-03
  • 2022-02-22
  • 2022-12-23
相关资源
相似解决方案