Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import javax.persistence.*;
import java.io.Serializable;
@Entity
@Table(name = "student_courses")
@IdClass(StudentCourseId.class)
public class StudentCourseEnrollment implements Serializable
{
@Id
@ManyToOne
@JoinColumn(name = "course_id", referencedColumnName = "id")
private Course course;
@Id
@ManyToOne
@JoinColumn(name = "student_id", referencedColumnName = "id")
private Student student;
@JoinColumn(name = "from_date")
private String fromDate;
@JoinColumn(name = "to_date")
private String toDate;
//TODO add getters and setters for all properties
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment