Skip to content

Instantly share code, notes, and snippets.

@chathurangat
Created March 21, 2018 05:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chathurangat/9e1227f685298bc6d231801fde1bc545 to your computer and use it in GitHub Desktop.
Save chathurangat/9e1227f685298bc6d231801fde1bc545 to your computer and use it in GitHub Desktop.
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