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]
|