Anonymous | Login | Signup for a new account | 12-17-2024 08:41 PST |
Main | My View | View Issues | Change Log | Docs |
Viewing Issue Simple Details [ Jump to Notes ] | [ View Advanced ] [ Issue History ] [ Print ] | ||||||||
ID | Category | Severity | Reproducibility | Date Submitted | Last Update | ||||
0001576 | [Resin] | major | always | 01-21-07 11:19 | 04-12-07 20:27 | ||||
Reporter | bregnvig | View Status | public | ||||||
Assigned To | westrupp | ||||||||
Priority | normal | Resolution | fixed | ||||||
Status | closed | Product Version | 3.1.1 | ||||||
Summary | 0001576: @OneTOMany and Inheritance problem | ||||||||
Description |
I'm going through your Amber tutorial. Works like a charm. I decide to play a bit with it so I expanded the “course” table with a discriminator column and another column called “formula”. I introduce a new class called RaceCourse, which extends from the Course class. With the following annotations: Course: @Entity @Table(name = "amber_basic_course") @Inheritance(strategy=InheritanceType.SINGLE_TABLE) @DiscriminatorColumn(name="discriminator", discriminatorType=DiscriminatorType.STRING) @DiscriminatorValue(value = "course") RaceCourse: @Entity @DiscriminatorValue(value="race") It works perfectly. So I create a class and table called participant. And a ManyToOne relation from the participant to the table: @ManyToOne@JoinColumn(name="course_id", nullable=false) public Course getCourse() { return course; } Course_id is a foreign key to the course table. This also works perfectly. Finally I introduce the @OneToMany in the Course class: @OneToMany(cascade=CascadeType.ALL, mappedBy="course") public Set<Participant> getParticipants() { return participants; } I can get the participants from the courses. No problem. The problem is the RaceCourse is no longer loaded properly (I use annotation on the properties not the fields). The setter methods for teacher, and formula are no longer called. Removing the getParticipants and setParticipants methods from the course class makes it all work perfectly again. To me it seems like there is a problem with one to many and inheritance. I can reproduce this every time. I have attached the code if you would like to look at it. |
||||||||
Additional Information | |||||||||
Attached Files | |||||||||
|
Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed. 26 unique queries executed. |