Hi,
Here are my hibernate mappings:
Code:
<class name="ie.admin.details.`Person" table="Person">
<id name="personID" column="PERSON_ID" type="string">
<!-- Chapter 5 of Hibernate Reference PDF for MySQL Auto increment fields -->
<generator class="identity"/>
</id>
...properties listed here...
<list name="photos" cascade="all" lazy="false">
<key column="person_id" not-null="true" />
<list-index column="file_id"/>
<one-to-many class="ie.admin.details.UploadedFile"/>
</list>
</class>
<class name="ie.admin.details.UploadedFile" table="MEDIA">
<id name="file_id" column="FILE_ID" type="string">
<!-- Chapter 5 of Hibernate Reference PDF for MySQL Auto increment fields -->
<generator class="identity"/>
</id>
<property name="person_id" column="PERSON_ID" type="string"/>
...Other properties listed here...
</class>
The error I get is that Hibernate generates the following prepared statement:
insert into MEDIA (PERSON_ID, FILE_TYPE, FILE_LOCATION, ORDER_NUM, TITLE, person_id, file_id) values (?, ?, ?, ?, ?, ?, ?)
Notice how PERSON_ID appears twice
I changed it so PERSON_ID to be upper case in all places. Hibernate just falls over at the point of loading its XML files then.
i tried insert="false". Hibernate does not like this either. In fact I get a message before I even compile
Attribute "insert" must be declared for element type "one-to- many".
I am using Hibernate 3.3.1
Please help I have this error for the last few days and no matter what i do I cant fix it
Thanks