Last active
March 21, 2018 15:00
-
-
Save chathurangat/b489cecb77b30dd10f4e53910ec2aa49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.persistence.*; | |
import java.io.Serializable; | |
import java.util.List; | |
@Entity | |
@Table(name = "students") | |
public class Student implements Serializable { | |
@Id | |
@GeneratedValue(strategy = GenerationType.AUTO) | |
private Long id; | |
private String name; | |
private String country; | |
private String email; | |
@Column(name = "created_at") | |
private String createdAt; | |
@ManyToMany | |
@JoinTable( | |
name = "student_courses", | |
joinColumns = {@JoinColumn(name = "student_id", referencedColumnName = "id")}, | |
inverseJoinColumns = {@JoinColumn(name = "course_id", referencedColumnName = "id")} | |
) | |
private List<Course> courses; | |
//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