瀏覽代碼

fixed annotations in entities

mpierse 5 年之前
父節點
當前提交
e25dca761b

+ 11
- 0
src/main/java/io/zipcoder/persistenceapp/home/Home.java 查看文件

@@ -1,9 +1,20 @@
1 1
 package io.zipcoder.persistenceapp.home;
2 2
 
3
+import javax.persistence.Column;
4
+import javax.persistence.Entity;
5
+import javax.persistence.GeneratedValue;
6
+import javax.persistence.Id;
7
+
8
+@Entity
3 9
 public class Home {
4 10
 
11
+    @Id
12
+    @GeneratedValue
13
+    @Column(name = "id")
5 14
     private Long id;
15
+    @Column(name = "address")
6 16
     private String address;
17
+    @Column(name = "homenumber")
7 18
     private String homenumber;
8 19
 
9 20
     public Home(){}

+ 10
- 1
src/main/java/io/zipcoder/persistenceapp/person/Person.java 查看文件

@@ -1,15 +1,24 @@
1 1
 package io.zipcoder.persistenceapp.person;
2 2
 
3
+import javax.persistence.*;
3 4
 import javax.persistence.criteria.CriteriaBuilder;
4 5
 import java.util.Date;
5 6
 
7
+@Entity
6 8
 public class Person {
7
-
9
+    @Id
10
+    @GeneratedValue
11
+    @Column(name = "id")
8 12
     private Long id;
13
+    @Column(name = "first_name")
9 14
     private String firstName;
15
+    @Column(name = "last_name")
10 16
     private String lastName;
17
+    @Column(name = "mobile")
11 18
     private String mobile;
19
+    @Column(name = "birthday")
12 20
     private String birthDate;
21
+    @Column(name = "home_id")
13 22
     private Short homeId;
14 23
 
15 24
     public Person(){