2 sinat 26662021 sinat_26662021 于 2016.04.07 11:17 提问

.hbm.xml 数据库映射文件报错 5C

**

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

<hibernate-mapping package="com.qtj.model">
    <class name="DrinkWaterIndexDataDay" table="QTJ_DrinkWaterIndexDataDay" dynamic-insert="true"
        dynamic-update="true">
        <id name="id" column="id" type="long">
            <generator class="native"></generator>
        </id>
        <many-to-one name="stationname" column="stationname" lazy="false" class="com.qtj.model.Station" />
        <property name="stationtype" column="stationtype" type="int" unique="false" />
        <property name="sampletime" column="sampletime" type="java.util.Date" unique="false"/>
        <property name="watertemp" column="watertemp" type="double" unique="false"/>
        <property name="PH" column="PH" type="double" unique="false"/>
        <property name="DO" column="DO" type="double" unique="false"></property>
        <property name="turbidity" column="turbidity" type="double" unique="false"/>
        <property name="conductivity" column="conductivity" type="double" unique="false"/>
        <property name="MnO4" column="MnO4" type="double" unique="false"/>
        <property name="NH3N" column="NH3N" type="double" unique="false"/>
        <property name="TP" column="TP" type="double" unique="false"/>
        <property name="TN" column="TN" type="double" unique="false"/>
        <property name="TOC" column="TOC" type="double" unique="false"/>
        <property name="flow" column="flow" type="double" unique="false"/>
        <property name="velocity" column="velocity" type="double" unique="false"/>  
    </class>
</hibernate-mapping>**




以上是.hbm.xml映射文件的代码。
eclipse一直对于<hibernate-mapping package="com.qtj.model">这一行报错:
The attribute type is required in the declaration of attribute "cata" for element "set".
之前写的时候没有出现过这样的错误,请问是什么原因,我应该怎么改?

2个回答

u010574826
u010574826   2016.04.07 11:32

Station这个类的属性要和配置文件中的name保持一致,检查一下

sinat_26662021
sinat_26662021 原来这个文件的代码是不报错的,我把它对应的类的属性加了几十个,就出现这个错误了,在.hbm.xml文件同步添加那几十个属性之后还是报这个错误,是不是属性太多的原因?
一年多之前 回复
sinat_26662021
sinat_26662021   2016.04.07 12:01

2016-04-07 11:51:45,282 SchemaUpdate:156 -[ERROR] You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'As double precision, Hg double precision, Cd double precision, Hchromium double ' at line 1
tomcat 启动时候报这个错

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!