-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Add object with property already exist (Joined-subclass)
PostPosted: Wed Apr 11, 2007 10:27 am 
Newbie

Joined: Wed Apr 11, 2007 9:55 am
Posts: 2
I've a problem with Hibernate.

I've have inheritance mapping with xdoclet joined subclass

The structure of my objects

Image

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);
}


--------------------------------


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.