views:

28

answers:

1

I have the following sql database that grails set up for me automatically. see picture for diagram

http://yfrog.com/ngskillsdbj

Whenever I try to delete all projects from an employee, I am getting a cascade re-save exception on the role_skill.

Is that because of the way this is set up where role_skill is keyed into skill and role? I set up the domain in grails to have different varieties of Skill, and I think that is what is causing my delete headache.

The reason I asked about the inverse, is because it seems like I need to somehow get skill to lose it's reference to role_skill when role_skill is deleted.

A: 

grails uses hibernate. yes.

you should understand that the inverse attribute indicates which side owns the relationship. The cascade attribute is all about transitive persistence.

I suggest you read the hibernate documentation.

The basic rule of thumb is if you want to delete a child from a parent, you should remove the child from the parents list, and you should remove the childs reference to its parent.

hvgotcodes
I have tried ever way possible to get this to work. My current mappings will allow me to delete one project at a time, for all projects, however, if I do employeeInstance.getProjects() and try to delete all project instances that is returned in that list, I get the cascade errors.
Derek
If you look at the diagram, you see that skill hasmany roleskills, and role hasmany roleskills. Do you see anything suspicious there?
Derek