i am getting the above error \"org.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): \". could someone
Without mapping end code is a bit hard...
This is caused, usually, because you are deleting an object associate to a collection.
You have to remove object from owning collection(s) and, after, delete object
parentObject.collection.remove(objToDelete);
session.delete(objToDelete);
session.save(parentObject);
But you can avoid this using deleteOrphan to mapped collection in this way
class ParentObject {
@OneToMany(orphanRemoval=true)
private List collection;
}
and code looks like
parentObject.collection.remove(objToDelete);
session.save(parentObject);
You don't more need object deletion because it is automatically removed by Hibernate when saving parentObject.
Hope can help