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
|