I've a problem with Hibernate.
I've have inheritance mapping with xdoclet joined subclass
The structure of my objects
When I add a new GeplandVerlof (subclass from Afspraak), with a setted TerugkeerPatroon, there is no problem. Multiple adds (different GeplandVerlofs and the same TerugkeerPatroon) goes fine too. (he adds objects from properties too)
When i try to add in a new function call another new GeplandVerlof, with the old TerugkeerPatroon set, it fails with the message:
org.springframework.orm.hibernate3.HibernateSystemException: a different object with the same identifier value was already associated with the session: [nl.carthago_ict.bres.planning.terugkeerpatroon.model.WekelijksTerugkerend#37]; nested exception is org.hibernate.NonUniqueObjectException: a different object with the same identifier value was already associated with the session: ......
Other object (from other tables who exists) give no problem when adding a new object to database.
Some code snippits
--------------------------------
/**
*
* @hibernate.joined-subclass table="pl_geplandeverloven"
* @hibernate.joined-subclass-key column="base_id"
*
*/
public class GeplandVerlof extends Afspraak {
.......
/**
* @hibernate.many-to-one
* column="terugkeerPatroonId"
* class="nl.carthago_ict.bres.planning.terugkeerpatroon.model.TerugkeerPatroon"
* cascade="save-update"
* lazy="false"
*
* @return TerugkeerPatroon
*/
public TerugkeerPatroon getTerugkeerPatroon() {
return terugkeerPatroon;
}
........
public void saveGeplandVerlof(final GeplandVerlof geplandVerlof) {
getHibernateTemplate().saveOrUpdate(geplandVerlof);
}
--------------------------------