-->
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.  [ 2 posts ] 
Author Message
 Post subject: Duplicates on merge
PostPosted: Thu Apr 26, 2007 1:54 pm 
Newbie

Joined: Sun Jun 25, 2006 9:27 pm
Posts: 18
Hi,
i have a problem with getting duplicate errors on merges. I have custom assigned primary keys, which is just a string. I have articles and items. many articles have many items. there is a unidirectional many-to-many form articles to items. Items, just like articles have a custom name which is the id. i attached a simplified version of my java files. I am using "session.merge(article)", which cascades down to the items - i have hashcode and equals - which ignore everything but the primary key (because I assign it).

I was wondering why hibernate still throws duplicate exceptions when I try to merge? I would appreciate any hints.

Thanks a lot!


[code]
class Article implements Serializable{
String uri;
Set<Item> items;
@Id @Column(columnDefinition=" varbinary(255) NOT NULL")
String getName() {..}
void setName(..

@ManyToMany(cascade=CasacadeType.ALL)
Set<items> getItems() {..}
setItems...

}

class Item implements Serializable {
public String name;
@Id @Column(columnDefinition=" varbinary(255) NOT NULL")
String getName() {..}
void setName(..
}
[/code]


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 26, 2007 2:46 pm 
Newbie

Joined: Sun Jun 25, 2006 9:27 pm
Posts: 18
PS:
I tried also session.saveOrUpdate(article) and get the following error:
a different object with the same identifier value was already associated with the session

Thanks!


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

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.