Why is the primary key generated for Student and Semester and not for Student and Course? This doesn't make any sense in this case. With this primary key, a Student can participate in only one course per semester. 'student_id' and 'course_id' should be defined as primary key! This would also match the Java map definition (the key must be unique, but the same value may be assigned to different keys)

EclipseLink currently processes a ManyToMany that uses a MapKeyJoinColumn the same as a traditional ManyToMany, so uses the source/target ids as the primary key. You can log a bug/enhancement request to have these types of mappings treated differently.

In general, you may be best off creating an Enrollment Entity that maps to the join table. This will give you better control of its persistence.