PlayFramework (JPA, Hibernate). Two entities software<-m:n->tag, software is owner of the relation. And I don't use any cascading.
I want to delete a tag which has some softwares in it.
Taking into consideration that software is owner side, I write in my Tag class:
class Tag {
@Override
public Tag delete() {
for (Software software : this.softwares) {
software.tags.remove(this);
software.save(); // if we delete this, we will have an error - a foreign key constraint fails
}
return super.delete();
}
}
It works well now, after I've added line software.save().
The question is: why i should do it?
I have another project - without Play Framework - which uses JPA->Hibernate and there I don't have to do it. So what's the difference?
In this link they do not use save() as well.