Skip to content

Commit 773ebe8

Browse files
committed
Entity
1 parent 2c0ee2f commit 773ebe8

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/main/java/com/example/postgresql/student/Student.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,23 @@
11
package com.example.postgresql.student;
22

3+
import javax.persistence.*;
34
import java.time.LocalDate;
45
import java.time.LocalDateTime;
56

7+
@Entity
8+
@Table
69
public class Student {
710

11+
@Id
12+
@SequenceGenerator(
13+
name = "student_sequence",
14+
sequenceName = "student_sequence",
15+
allocationSize = 1
16+
)
17+
@GeneratedValue(
18+
strategy = GenerationType.SEQUENCE,
19+
generator = "student_sequence"
20+
)
821
private Long id;
922
private String name;
1023
private String email;
@@ -28,6 +41,10 @@ public Student(String name, String email, LocalDate dob, Integer age) {
2841
this.age = age;
2942
}
3043

44+
public Student() {
45+
46+
}
47+
3148
public Long getId() {
3249
return id;
3350
}

0 commit comments

Comments
 (0)