-->
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: Rekursive Relation mit Annotations
PostPosted: Mon May 01, 2006 6:34 pm 
Newbie

Joined: Tue Apr 18, 2006 12:33 pm
Posts: 12
Hallo zusammen,

ich habe hier eine Klasse, die ich mittels einer rekursiven Relation mit sich selbst verknüpfen möchte. Ich benutze Annotations, und zwar folgendermaßen:

Code:
   /**
    *
    * @return Returns a list of Persons (finders).
    */
   @ManyToMany(targetEntity = Person.class, mappedBy = "doctors", cascade = { CascadeType.PERSIST })
   public List<Person> getFinders()
   {
      return finders;
   }

   /**
    *
    * @return Returns a list of Persons (doctors).
    */
   @ManyToMany(targetEntity = Person.class, cascade = { CascadeType.PERSIST })
   @JoinTable(name = "finder_doctor", joinColumns = { @JoinColumn(name = "finder_id") }, inverseJoinColumns = { @JoinColumn(name = "doctor_id") })
   public List<Person> getDoctors()
   {
      return doctors;
   }

Problem ist, dass z.B. wenn ich mit setFinders() für ein Objekt person eine entsprechende Liste von Persons setze, dann Session.update(person) aufrufe, diese nicht in der Tabelle finder_doctor eingetragen werden.

Hat jemand eine Ahnung, warum nicht?


Top
 Profile  
 
 Post subject:
PostPosted: Mon May 01, 2006 6:42 pm 
Newbie

Joined: Tue Apr 18, 2006 12:33 pm
Posts: 12
Hat sich erledigt... Austauschen der beiden Annotations und Umbenennung des "doctors" mappedBy in "finders" hat den gewünschten Erfolg gebracht.


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.