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: Help with saving a object with a collection
PostPosted: Sun Feb 21, 2010 1:07 am 
Newbie

Joined: Thu Mar 26, 2009 8:50 pm
Posts: 5
Event time I save my object after adding children it bombs.

For instance.. Class a has a bag of items ( id's 12, 13, and 14 )

I have already saved to the collection so they exist in a many to many mapping table.

My question is, now do I tell it to skip re-adding pre-existing entries.

When I save it tries to save id's 12, 13, and 14 even though already exist. And ideas?

{"a different object with the same identifier value was already associated with the session: 12, of entity: Class Name Here"}
<class name="DocumentSavingsEvent, DomainObjects" table="DCSEvent" lazy="false">

<id name="Id" column="EventId" unsaved-value="-1">
<generator class="native" />
</id>

<bag name="ActivityListItems" table="DCSEventActivityItemTypeMapping" lazy="false" cascade="save-update" inverse="false">
<key column="EventId" />
<many-to-many class="DocumentSavingsCostActivityItem, DomainObjects" column="ActivityListId" />
</bag>

</class>

Thanks,
Nick


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.