Hello all,
I've got a problem with a delete action.
I've got 3 classes : adresse and SipContact with an association classe Binding.
I want to delete objects from the association table Binding using the FK id_SipContact as criteria with something like :
NB : I'm using Spring to manage hibernate session, factories and DAO layers.
Code:
public void deleteBindByContact(SipContact sipContact)throws DataAccessException {
final Integer id = sipContact.getId_SipContact();
HibernateCallback callback = new HibernateCallback() {
public Object doInHibernate(Session session) throws HibernateException, SQLException {
session.delete("from Binding where id_sipcontact=?",id ,Hibernate.INTEGER);
return null;};
};
getHibernateTemplate().execute(callback);
}
when this code is execute i got this exception :
org.springframework.orm.hibernate.HibernateObjectRetrievalFailureException: deleted object would be re-saved by cascade (remove deleted object from associations): 1, of class: net.pointbleu.model.Binding; nested exception is net.sf.hibernate.ObjectDeletedException: deleted object would be re-saved by cascade (remove deleted object from associations): 1, of class: net.pointbleu.model.Binding
cascade is set to "none" in my association class and "save-update" in my sipContact class. But this properties seems not to change anything.
Any clue on this problem?
Thank you in advance.
sebi