-->
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.  [ 5 posts ] 
Author Message
 Post subject: a one-to-many mapping problem?
PostPosted: Wed Oct 12, 2005 10:53 pm 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
Hi
hibernate3
parent table sys_users,primary key id
child table bbs_topics,foreign key userid

pojos SysUsers.java,BbsTopics.java

in child mapping file, there is no userid field replaced by a set.
how can I get the userid contents directly without using SysUsers

_________________
leon


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 12, 2005 11:05 pm 
Expert
Expert

Joined: Mon Jul 04, 2005 5:19 pm
Posts: 720
what?


Top
 Profile  
 
 Post subject: please post java code and hbm files
PostPosted: Wed Oct 12, 2005 11:46 pm 
Newbie

Joined: Fri Oct 07, 2005 12:03 am
Posts: 3
Hi,

Please post the relevant java code and the hbm files.

If you need one to many mapping, you can define a set and have a one-to-many mapping.

There's a section in Hibernate reference, Chapter 2 - Introductionto Hibernate. (Mapping Associations). Please read this. This would really help.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 13, 2005 1:20 am 
Beginner
Beginner

Joined: Thu Jul 07, 2005 5:17 am
Posts: 30
SysUsers.hbm.xml:
<class name="SysUsers" table="sys_users">
<id name="id" column="Userid" type="java.lang.String">
<generator class="assigned"/>
</id>

<property name="password" column="Password" type="java.lang.String" />
<property name="username" column="Username" type="java.lang.String" />
......
<set name="bbsTopicSet" inverse="true">
<key column="Creator"/>
<one-to-many class="BbsTopic"/>
</set>
......

BbsTopic.hbmlxml:
<class name="BbsTopic" table="bbs_topic">
<id name="id" column="ID" type="java.lang.String">
<generator class="uuid.hex"/>
</id>

<property name="topic" column="topic" type="java.lang.String" />
......
<many-to-one name="sysUsers" column="Creator" class="SysUsers" />

How can I get the column Creator's date in table bbs_topic?

_________________
leon


Top
 Profile  
 
 Post subject:
PostPosted: Tue Nov 01, 2005 9:52 pm 
bbsTopicSet.getsysUsers().getCreator()


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