I have defined a MANY-TO-MANY relationship between two entities via a JoinTable.
ALERT
--------
alertId
alertType
ALERTCONTACTXREF
-----------------------------
alertId
contactId
CONTACT
-------------
contactId
contactName
The many to many association was defined on the alert entity. So there is this method on the alert entity:
@Entity
Alert {
@Column Long alertId;
@Column String alertType;
@ManyToMany( fetch=FetchType.EAGER )
@JoinTable( name="ALERTCONTACTXREF",
joinColumns= @JoinColumn( name="ALERTID",
referencedColumnName="ALERTID" ),
inverseJoinColumns= @JoinColumn( name="CONTACTID",
referencedColumnName="CONTACTID" ) )
private Set<Contact> contacts;
Set<Contact> getContacts();
}
My question is this:
If I delete a contact from the Set of contacts of an alert instance, will hibernate delete the corresponding record in the cross ref/join table (ie ALERTCONTACTXREF) ?
I would only want the association deleted, not the associated entity.
-Mike
|