Hibernate version: 3
Name and version of the database you are using: MySQL 4.1
Hello. I have a strange problem, and while I'm burdened with all the hours staring at the code, the fresh look will hopefully easily find the "little pebble".
I have the following XDoclet annotation (and getter/setter definitions):
Code:
private Set answers = new HashSet();
...
/**
* @hibernate.set table="ctx_answers" cascade="save-update" lazy="false"
* @hibernate.collection-key column="ctx_id"
* @hibernate.collection-many-to-many class="com.jimpanel.model.survey.QuestionAnswer" column="id"
*/
public Set getAnswers() {
return this.answers;
}
public void setAnswers(Set answers) {
this.answers = answers;
}
and
Code:
/**
* @hibernate.class table="q_answer"
*/
public class QuestionAnswer ....
When I save the session (Note: using org.springframework.orm.hibernate3.support.HibernateDaoSupport.getHibernateTemplate()) only the most recent answers are written to ctx_answers, and the rest is deleted.
However, all the answers are inserted in the q_answer table.
Right before calling the saveOrUpdate, I log the contents of the Set - it contains all the answers.
Why is that supposed to happen?