-
1. Re: Preview 5 -- Bug when Inheritance used with @OneToMany
epbernard Apr 18, 2005 8:51 AM (in response to ttarhan)Are you using the same fk column "person_id" to refer to both Dogs and Cats. Try to explicit the @JoinColumn with different name to make it work.
-
2. Re: Preview 5 -- Bug when Inheritance used with @OneToMany
ttarhan Jun 17, 2005 2:20 AM (in response to ttarhan)Sorry it took so long to get back to this, but this problem still exists, and no combination of JoinColumn can fix the problem. Hibernate simply doesn't select the discriminator field. The only solution would be to have dog_person_id and cat_person_id in the Pets table, which obviously is a bad thing to do.
-
3. Re: Preview 5 -- Bug when Inheritance used with @OneToMany
epbernard Jun 17, 2005 4:57 AM (in response to ttarhan)"ttarhan" wrote:
The only solution would be to have dog_person_id and cat_person_id in the Pets table, which obviously is a bad thing to do.
I completly disagree, this is obviously the right thing to do. -
4. Re: Preview 5 -- Bug when Inheritance used with @OneToMany
ttarhan Jun 17, 2005 1:08 PM (in response to ttarhan)Why wouldn't you reuse a single field, person_id? Regardless of if it's a Cat or a Dog, it's still linked to a Person. It seems like a waste to have two fields for that purpose.
Shouldn't hibernate just select the discriminator type, or better yet, use the discriminator as a WHERE condition when you're only looking for a certain type? -
5. Re: Preview 5 -- Bug when Inheritance used with @OneToMany
epbernard Jun 20, 2005 5:32 AM (in response to ttarhan)There are ways to do that using @Where which is an hibernate specific annotations. But I still don't recommend that.