Hibernate version:3.6.2 final
Personal Oracle Database 11g Release 22.214.171.124.0 - Production
The relationship is like 1 organization can have multiple volunteers. However 1 volunteer may or may not be linked to an organization.Organization.java
private Set<Volunteer> volSets = new HashSet<Volunteer>();
private Organization org;
<set name="volSets" cascade="all" inverse="true" lazy="false" >
<key column="org_id" not-null="true" />
<one-to-many class="com.spring.model.Volunteer" />
<many-to-one name="org" column="org_id" cascade = "none"
Ok, lets say there is 1 volunteer linked with this organization.
Then if we delink this volunteer from the organization and then call the delete on the organization, shouldn't it just leave an orphan volunteer?
It instead deletes the volunteer as well.
org = orgService.getOrganization(org.getId());
vol = (Volunteer) org.getVolSets().iterator().next();
This generates the following SQL:
Hibernate: delete from volunteer where vol_id=? and version=?
Hibernate: delete from organization where org_id=? and version=?
I think that's incorrect.Could you please suggest?