-->
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.  [ 3 posts ] 
Author Message
 Post subject: bidirectional many-to-many and hibernate annotation
PostPosted: Fri Jun 24, 2005 5:19 am 
Newbie

Joined: Tue Dec 16, 2003 12:02 pm
Posts: 14
Location: Geneva, Switzerland
b]Hibernate version:[/b] 3.x

Name and version of the database you are using: postgres8.0


Trying to implement bidirectional many-to-many mapping using hibernate annotations, without success.
My code:

@Entity
public class Keyword {
// stuff deleted
/**
* @return Returns the goterms.
*/
@ManyToMany(targetEntity="controlvocab.Goterm")
@Cascade(CascadeType.SAVE_UPDATE)
@AssociationTable(table=@Table(name="keyword2go"),
joinColumns={@JoinColumn(name="keyword_id")},
inverseJoinColumns={@JoinColumn(name="go_id")} )
public Set<Goterm> getGoterms() {
return goterms;
}
// ...
}


@Entity
public class Goterm {
// ...
/**
* @return Returns the keywords.
*/
@ManyToMany(mappedBy="goterms")
public Set<Keyword> getKeywords() {
return keywords;
}
// ...
}

The problem: I can add/delete Goterms from a Keyword object as expected. However, doing it the other way round, ie add/delete Keywords from a Goterm seems to work, but in fact the changes are not persisted, ie. the association table keyword2go is not updated.


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 4:48 am 
Regular
Regular

Joined: Mon Apr 25, 2005 5:36 am
Posts: 103
hey I have the same pb !!!

do you have find a soluce?


thanks


Top
 Profile  
 
 Post subject:
PostPosted: Tue Jun 28, 2005 5:45 am 
Newbie

Joined: Tue Dec 16, 2003 12:02 pm
Posts: 14
Location: Geneva, Switzerland
julientarrago wrote:
hey I have the same pb !!!

do you have find a soluce?


thanks



sadly, no. Maybe it's very obvious? I am puzzled, because I've mapped bi-directional n,m mappings successfully using the xml syntax... I've also tried changing the cascade type, removing it altogether, and I still get the same behaviour.


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 3 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.