1

as the heading implies, I've got a composite primary key that should reference two objects, in order to be able to acces those in JSF lateron.

Class should look like this...:

    @Entity
    public class Timetable {
        public static final String findAll = "Timetable.findAll";

        @Id
        @ManyToOne
        @JoinColumn(name = "lectureId")
        private Lecture lecture;

        @Id
        @ManyToOne
        @JoinColumn(name = "timeslotId")
        private Timeslot timeslot;

... so I can later access those objects in JSF like this:

#{timetable.timeslot.timeslotId}

However glassfish is now caliming about missmatching types since lecture and timeslot are objects but reference primary key of type Long.

Is there an easy trick to fix this?

For further information I had a look at the following sources: http://docs.oracle.com/...

Thanks in advance =)

Micromonger
  • 150
  • 10
  • That link merely explains typical `@Embeddable` and `@IdClass` annotations respectively that can be used to form a composite primary key. Those `Lecture` and `Timeslot` composite/complex objects appear to be entities forming a `@ManyToOne` relationship with `Timetable`. How could they then be part of a composite primary key in your RDBMS? You could however, have a separate/usual primary key field (non-composite) in your database table retaining both of these relationships as they are. – Tiny Jun 12 '15 at 13:33

0 Answers0