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"
It shouldn't be related to needing to make it bi-directional.
Usually the best approach is to remove the object from the collection, then update/save the parent object. The cascade option on the collection and Hibernate seeing it has been removed from the collection will tell hibernate to delete the removed object.