-->
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: Add a role
PostPosted: Tue Mar 21, 2006 1:28 pm 
Newbie

Joined: Fri Mar 17, 2006 4:35 pm
Posts: 1
3.1.3
PostgreSQL 8.1.2

Game<-(1:N)->Round
Round<-(N:M)->Person

I will add Role for each Person( A person only has one Role in one Round)
So I define a class:

<class name="PersonRole" table="person_role">

<composite-id name="compId" class="PersonRoleCompositeID">
<key-property name="roundId" column="round_id"></key-property>
<key-property name="personId" column="person_id"></key-property>
</composite-id>

<many-to-one name="round" class="Round" column="round_id" insert="false" update="false"/>
<many-to-one name="person" class="Person" column="person_id" insert="false" update="false"/>

<many-to-one name="role" class="Role" column="role_id" not-null="true"/>

</class>

public class PersonRole {

private PersonRoleCompositeID compId;

private Round round;

private Person person;

private Role role;
...
...
}

How could I add into Round class?
Thanks.


Top
 Profile  
 
 Post subject: my 2c
PostPosted: Wed Mar 29, 2006 8:17 pm 
Expert
Expert

Joined: Fri Jul 22, 2005 2:42 pm
Posts: 670
Location: Seattle, WA
I would rather create class PersonRoundLink and have role property there. In the case we will be dealing with simple ternary type of relationships

http://www.hibernate.org/hib_docs/v3/re ... ns-ternary

_________________
--------------
Konstantin

SourceLabs - dependable OpenSource systems


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.