org.hibernate.InvalidMappingException:无法解析资源houseDocumenter / House.hbm.xml

时间:2015-10-24 12:37:52

标签: java xml eclipse hibernate pojo

始终获取此错误。 我正在使用eclipse luna 我的House.hbm.xml在eclipse中验证

<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!-- Generated 24-Oct-2015 10:24:27 by Hibernate Tools 3.4.0.CR1 -->
<hibernate-mapping>
    <class name="houseDocumenter.House" table="HOUSE">
        <id name="id" type="int">
            <column name="ID" />
            <generator class="assigned" />
        </id>
        <property name="imageURL" type="java.lang.String">
            <column name="IMAGEURL" />
        </property>
        <property name="propertyAddress" type="java.lang.String">
            <column name="PROPERTYADDRESS" />
        </property>
        <property name="evaluationCompleteYN" type="java.lang.String">
            <column name="EVALUATIONCOMPLETEYN" />
        </property>
        <property name="evaluationText" type="java.lang.String">
            <column name="EVALUATIONTEXT" />
        </property>
        <property name="followUpYN" type="java.lang.String">
            <column name="FOLLOWUPYN" />
        </property>
        <property name="followUpText" type="java.lang.String">
            <column name="FOLLOWUPTEXT" />
        </property>
        <property name="originatingWebURL" type="java.lang.String">
            <column name="ORIGINATINGWEBURL" />
        </property>
        <property name="price" type="int">
            <column name="PRICE" />
        </property>
        <property name="valueForMoney" type="java.lang.String">
            <column name="VALUEFORMONEY" />
        </property>
        <property name="valuationNotes" type="java.lang.String">
            <column name="VALUATIONNOTES" />
        </property>
        <property name="schoolNameKey" type="java.lang.String">
            <column name="SCHOOLNAMEKEY" />
        </property>
        <property name="schoolRatingKey" type="java.lang.String">
            <column name="SCHOOLRATINGKEY" />
        </property>
        <property name="broadbandProviderKey" type="java.lang.String">
            <column name="BROADBANDPROVIDERKEY" />
        </property>
        <property name="broadbandSpeed" type="int">
            <column name="BROADBANDSPEED" />
        </property>
        <property name="mobilePhoneConnectivity" type="java.lang.String">
            <column name="MOBILEPHONECONNECTIVITY" />
        </property>
        <property name="transportLinksOkYN" type="java.lang.String">
            <column name="TRANSPORTLINKSOKYN" />
        </property>
        <property name="tenure">
            <column name="TENURE" />
        </property>
    </class>
</hibernate-mapping>

我试图使用Hibernate为我的系统生成字典pojos。 它工作了一次但后来放弃了。

我很感激任何帮助!

Hibernate错误消息窗口包含以下内容:

org.hibernate.InvalidMappingException: Could not parse mapping document from resource houseDocumenter/House.hbm.xml
Could not parse mapping document from resource houseDocumenter/House.hbm.xml
org.hibernate.InvalidMappingException: Could not parse mapping document from resource houseDocumenter/House.hbm.xml
Could not parse mapping document from resource houseDocumenter/House.hbm.xml
org.hibernate.PropertyNotFoundException: field [tenure] not found on houseDocumenter.House
field [tenure] not found on houseDocumenter.House

1 个答案:

答案 0 :(得分:0)

我找到了我特定问题的答案。 hbm.xml需要一个类型。

一个:

<property name="tenure">
            <column name="TENURE" />
        </property>

正确:

 <property name="tenure" type="java.lang.String">
            <column name="TENURE" />
        </property>

小事意味着很多。

感谢所有看过的人。