Hibernate version:3.1 Beta
Name and version of the database you are using:oracle 9i
I have an entity called "SCHOOL", which is associated (ONE TO MANY relation) to an entity called "STUDENT" that inherited from the abstract entity called "PERSON".
The code of the entities is like this:
The Person entity:
@Entity
@Table(name="PERSON")
@Inheritance(discriminatorValue="1", strategy=InheritanceType.SINGLE_TABLE, discrimunatorType=DiscriminatorType.INTEGER)
@DiscriminatorColumn(name="TYPE")
public abstract class Person imlements Serializable {
...
}
The Student entity:
@Entity
@Inheritance(discriminatorValue="2")
public class Student extends Person imlements Serializable {
...
}
The School entity:
@Entity
@Table(name="SCHOOL")
public class School imlements Serializable {
...
@OneToMany(targetEntity=Student.class, mappedBy="school")
public List<Student> getStudents() {
return students;
}
}
When I used merge to the master entity, I get all the kinds of Persons to the students list and not just the Students as I would expect.
I'm trying a lot, but couldn't undersatnd why it merges like this.
By the way, when I merge the Student without association it works great.
Thanks, Roni[/quote]
|