I have sketched out the relationship details below. A volunteer has a collection of Opportunities. Being associated with this table means that they have volunteered for a position at an event.
When I remove the Opportunity from the Volunteers collection, Hibernate tries to delete the entire Opportunity row. Instead, I want Hibernate to set the "volunteer_id" column to NULL. How can this be done? I have put my current associations below.
Many thanks,
Joshua
Code:
Volunteer
| 1
|
|
\|/ M
Event 1--->M Opportunity M<--->M Position
OPPORTUNITY
-----------------------
id
version
event_id
volunteer_id
position_id
Code:
/**
* This mapping appears in the Volunteer class
* @hibernate.set name="opportunities" inverse="false" lazy="false" cascade="save-update"
* @hibernate.collection-key column="volunteer_id"
* @hibernate.collection-one-to-many class="Opportunity"
*/
/**
* This mapping apprears in the Opportunity class
* @hibernate.many-to-one name="volunteer" column="volunteer_id" class="Volunteer" not-null="false" lazy="false" inverse="true"
* @return Volunteer
*/