Mantis Bugtracker

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:

@Table(name = "amber_basic_course")
@DiscriminatorColumn(name="discriminator", discriminatorType=DiscriminatorType.STRING)
@DiscriminatorValue(value = "course")


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

- Relationships

- Notes
04-12-07 20:27


- Issue History
Date Modified Username Field Change
01-21-07 11:19 bregnvig New Issue
04-12-07 20:26 westrupp Status new => assigned
04-12-07 20:26 westrupp Assigned To  => westrupp
04-12-07 20:27 westrupp Status assigned => closed
04-12-07 20:27 westrupp Note Added: 0001841
04-12-07 20:27 westrupp Resolution open => fixed
04-12-07 20:27 westrupp Fixed in Version  => 3.1.1

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
29 total queries executed.
26 unique queries executed.
Powered by Mantis Bugtracker