Hi , I have a Person class which contains collection of PersonContact objects Person{ private Collection<PersonContact> colContact = Collections.emptyList();
public void setColContact(Collection<PersonContact> colContact) {
this.colContact = colContact; }
@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY) @JoinColumn(name = "PRSN_ID") @org.hibernate.annotations.Cascade(value = org.hibernate.annotations.CascadeType.DELETE_ORPHAN) public Collection<PersonContact> getColContact() { return colContact; } } Now first am saving a Person in db without any PersonContact obj . Then when I update the Person by adding a PersonContact object ... this.getJpaTemplate().merge(person); it is throwing
Caused by: org.hibernate.HibernateException: A collection with cascade="all-delete-orphan" was no longer referenced by the owning entity instance: com.qwest.ngs.contacts.common.domain.Person.colContact
Any help is greatly appreciated
|