Mantis - Resin
|
|||||
Viewing Issue Advanced Details | |||||
|
|||||
ID: | Category: | Severity: | Reproducibility: | Date Submitted: | Last Update: |
1576 | major | always | 01-21-07 11:19 | 04-12-07 20:27 | |
|
|||||
Reporter: | bregnvig | Platform: | |||
Assigned To: | westrupp | OS: | |||
Priority: | normal | OS Version: | |||
Status: | closed | Product Version: | 3.1.1 | ||
Product Build: | Resolution: | fixed | |||
Projection: | none | ||||
ETA: | none | Fixed in 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. |
||||
Steps To Reproduce: | |||||
Additional Information: | |||||
Relationships | |||||
Attached Files: |
Notes | |||||
|
|||||
|
|