tags:

views:

36

answers:

0

Hello... I have server Entities.... Suppose an

Entity named Exam

this entity has a long ID...

There are serveral types of exams...

Exam_Numeric, Exam_Boolean etc.....

which use the same ID (shared id) with Exam... depending on the type of the exam...

My problem is that i want to make an other type called Exam_Composite

This entity should have fields like...

exam_id , exam_id

Its like a many to many relationship i think ..

In order an exam to own some other exams..

However here is one try

@Entity
public class Exam_Composite implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id    
    private Long id;

    @MapsId
    @OneToOne
    private Exam exam;

    @OneToMany
    private List<Exam> exams;

The problem is that using this aproach an other Entity is created... Is there any other solution ?