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: Discriminator issue with parent.getSubclasses()
PostPosted: Sat Aug 26, 2006 1:12 pm 
Newbie

Joined: Wed Aug 16, 2006 1:13 pm
Posts: 9
Location: Oklahoma
I have an issue with selecting what I want using the inheritance option and discriminator columns. I am placing classes Person, Child, and Parent in the same Person table using person_type = PERSON_PLAIN, PERSON_CHILD, and PERSON_PARENT as the respective types. Also, I have one to many relationships with Household class and get and set methods returning Collection<Child> and Collection<Parent>. I used Household.getParents().add(Parent) and getChildren().add(Child) to add two Parent classes and one Child class. All of that works and in the Person table I have two Parent(s) and one Child and they are "discriminated" in the person_type column correctly.

My issue is when I call Household.getParents() I get a Collection<Parent> that contains all three Person(s) ... both Parent(s) and one Child. Am I doing something wrong? or does anyone have any suggestions? I use a flat (non-hierarchical) structure at work and the one-to-many lazy mapping works fine because we use a table per class. But, we are also using JDK 1.4.2_08 using Bag in the mapping and List as the class return.

Please help. I really like the inherited model concept.

_________________
Piratepete
david.whitehurst@wisplinx.com


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.