tags:

views:

12

answers:

0

I'm using hibernate with the following class

<composite-id name="ID" class="HomePersonID">
  <key-property name="Country" column="country" type="int" />
  <key-property name="Home" column="home" type="int" />
</composite-id>

<many-to-one name="Person" class="Person" cascade="none" fetch="select">
  <column name="country" />
  <column name="person" />
</many-to-one>

With this XML I can load elements perfectly, but when I try to do a Save, I have an error with the following log:

INSERT INTO home_person (person, country, home) VALUES (?, ?, ?)
binding '1' to parameter: 0
binding '16' to parameter: 1
binding '1' to parameter: 2
binding '31' to parameter: 3

when 1 is country, 31 is home and 16 is person.

Obviously it fails because of the exceeding number of input parameters. Is there any way to tell hibernate that one of the 'country' columns should not be passed as parameter?