-->
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: Mapping strategy for custom assigned IDs
PostPosted: Thu Apr 26, 2007 10:05 pm 
Newbie

Joined: Sun Jun 25, 2006 9:27 pm
Posts: 18
Hi,
I am experiencing some problems with a Structure that looks like the following:

Article has Set<Topics> has Set<Item>
I am assigning the IDs myself, they're strings. However, I try to saveOrUpdate the final article and cascade the Topics and Items down. There is however one problem - some topics might include the same items - that's when I get the Following error:
a different object with the same identifier value was already associated with the session: [com.headcaselabs.nlp.wiki.entities.Item#Titanic]


I would appreciate any recommendations... sorry for posting previously related things - I think however that I have narrowed the problem down and this here is more specific!

Thanks!


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

@ManyToMany(cascade=CasacadeType.ALL)
Set<Topic> getTopic() {..}
setTopic...

}

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

@ManyToMany(cascade=CasacadeType.ALL)
Set<Item> 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 11:54 pm 
Newbie

Joined: Sun Jun 25, 2006 9:27 pm
Posts: 18
PS:
I *only* have problems when I am trying to update an object that contains special characters. However, I checked, the database (MySQL v 5.0.37) stores the values as UTF-8 - but for some reason, hibernate seems to interfere and scramble the id-string so that it thinks that the object containing the special chars should be inserted - even though it should be updated... anyone else experiencing this bug?


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.