-->
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: Beziehungen mit <set></set>
PostPosted: Thu Sep 20, 2007 3:52 am 
Newbie

Joined: Thu Sep 20, 2007 3:24 am
Posts: 2
hi,

ich bin anfänger und habe ne frage zur realisierung von beziehungen in der db mit hibernate. muss man unbedingt mit <set></set> arbeiten? reicht es nicht den fremdschlüssel mit <many-to-one... zu zuweisen.

folgendes Beispiel:

es gibt die relation Professor und Vorlesung.jede Vorlesung wird von einem Professor gelseen,und jeder professor kann mehrere Vorlesungen lesen.
Muss ich jetzt in der Datei Professor.hbm.xml folgendes einfügen.

Code:
<set name="vorlesungen" inverse="true">
   <key column="GelesenVon" />
   <one-to-many class="Vorlesung" />
</set>


oder reicht das ich in der Datei Vorlesung.hbm.xml
Code:
<many-to-one name="gelesenVon" column="GelesenVon" not-null="true" />

einfüge?


Top
 Profile  
 
 Post subject:
PostPosted: Mon Oct 08, 2007 4:14 pm 
Expert
Expert

Joined: Tue Nov 23, 2004 7:00 pm
Posts: 570
Location: mostly Frankfurt Germany
Dokumentation Stickwort unidirektional und bidirektional (beides geht)

_________________
Best Regards
Sebastian
---
Training for Hibernate and Java Persistence
Tutorials for Hibernate, Spring, EJB, JSF...
eBook: Hibernate 3 - DeveloperGuide
Paper book: Hibernate 3 - Das Praxisbuch
http://www.laliluna.de


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.