JPA composite primary key referencing objects; JSF

213 views Asked by At

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 =)

0

There are 0 answers