-->
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.  [ 1 post ] 
Author Message
 Post subject: How to navigate to other objects from the same table?
PostPosted: Thu Aug 17, 2006 11:53 am 
Newbie

Joined: Sat Aug 12, 2006 3:20 am
Posts: 4
Hi!

I have the following EMPLOYEE table which contains one director (TYPE=D) and two managers (TYPE=M). The managers are reporting to the director John (SUPERIOR=0):

Code:
  ID  NAME    TYPE  SUPERIOR
  0   John    D     NULL
  1   Andrew  M     0
  2   Mark    M     0

I have created the following mapping:

Code:
  <class name="Employee" table="EMPLOYEE">
  <id column="ID" type="integer"/>
  <discriminator column="TYPE" type="string"/>
  <subclass name="Director" discriminator-value="D"/>
  <subclass name="Manager" discriminator-value="M"/>
  </class>

How can I create the mapping so that a Director.getManagers() will return a list of Manager objects?
Whereas the Manager.getDirector() will return the corresponding Directory object?

Please help, thank you!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

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.