Skip to content

Instantly share code, notes, and snippets.

@hakaneroztekin
Created August 20, 2019 10:02
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 hakaneroztekin/800c9716355cd8a631462742bf5b4bb9 to your computer and use it in GitHub Desktop.
Save hakaneroztekin/800c9716355cd8a631462742bf5b4bb9 to your computer and use it in GitHub Desktop.
@Entity // the class will be stored in the DB
class HighSchool {
@Id // Id annotation
@GeneratedValue(strategy = GenerationType.IDENTITY) // Auto generated value
@Column(name = "id") // We can specify the column name (optional)
private Long id;
@Column(name = "name")
private Long name;
@OneToMany
@Column(name = "student")
private Student student;
// setters and getters and other methods
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment