Hi
I have a parent class(Person) and a child class (UploadedFile)
All updates, inserts work fine but deletes do not. I get this error
i get this error
ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations)
if this is called
person.getPhotos.remove(0);
and then this is called
session.update(person)
Does the child UploadedFile need to have a person reference as this is what I see on the net?
But is there anyway to avoid this as I think it is over kill
I tried inverse="true" and insvers="false"
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>
....
<list name="photos" cascade="all-delete-orphan" lazy="false">
<!--need update="false" other wise prepared stmt is generated with gym_id twice -->
<key column="person_id"/>
<list-index column="file_id"/>
<one-to-many class="ie.gymlockr.admin.details.UploadedFile" />
</list>
</class>
<class name="ie.gymlockr.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>
<!--need update="false" and update="false other wise prepared stmt is generated with gym_id twice due to Gym mappings -->
<property name="person_id" column="PERSON_ID" type="string" insert="true" update="false"/>
<property name="file_type" column="FILE_TYPE" type="int"/>
<property name="file_location" column="FILE_LOCATION" type="string"/>
<property name="order_num" column="ORDER_NUM" type="int"/>
<property name="title" column="TITLE" type="string"/>
</class>