I realize this topic has been posted before, and I've tried to solve this be referencing other threads, but still feel like I need another eye to look at it. Anyway, the error I'm getting is: org.hibernate.MappingException: Foreign key (FKB95A8278CD821C6C:images [elt])) must have same number of columns as the referenced primary key (images [propertyId,elt])
Here are my 2 mapping files:
PropertyInfo.hbm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class
name="com.realestate.model.PropertyInfo"
table="property_listings">
<id
name="id"
column="propertyId"
type="long"
unsaved-value="0">
<generator class="native"/>
</id>
<property name="listingType"/>
<property name="propertyType"/>
<property name="firstName"/>
<property name="lastName"/>
<property name="propertyAddress"/>
<property name="propertyCounty"/>
<property name="propertyCity"/>
<property name="askingPrice"/>
<property name="email"/>
<property name="dayareacode"/>
<property name="dphone1"/>
<property name="dphone2"/>
<property name="description"/>
<property name="numBedrooms"/>
<property name="numBaths"/>
<property name="postDate"/>
<set name="images" table="images" cascade="save-update" inverse="true">
<key column="propertyId"/>
<one-to-many class="com.realestate.model.Image"/>
</set>
</class>
</hibernate-mapping>
Image.hbm.xml:
Code:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 2.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-2.0.dtd">
<hibernate-mapping>
<class name="com.realestate.model.Image" table="images">
<id
name="id"
column="id"
type="long"
unsaved-value="0">
<generator class="native"/>
</id>
<property name="image"/>
<property name="name"/>
<many-to-one
name="info"
column="propertyId"
class="com.realestate.model.PropertyInfo"/>
</class>
</hibernate-mapping>
Any insight as to what I have to change would be greatly appreciated. Thanks.