Search code examples
javaxmleclipsehibernatepojo

org.hibernate.InvalidMappingException: Could not parse mapping document from resource houseDocumenter/House.hbm.xml


Getting this error all the time. I'm using eclipse luna My House.hbm.xml validates in 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>

I'm trying to use Hibernate to produce the dictionary pojos for my system. It worked once but then gave up.

I'd appreciate any help!

The Hibernate error message window contains the following:

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

Solution

  • I have found the answer to my particular problem. The hbm.xml wanted a type.

    Previous:

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

    Correct:

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

    Little things mean a lot.

    Thanks to everyone who looked.