Преглед на файлове

fixed annotations in entities

mpierse преди 5 години
родител
ревизия
e25dca761b
променени са 2 файла, в които са добавени 21 реда и са изтрити 1 реда
  1. 11
    0
      src/main/java/io/zipcoder/persistenceapp/home/Home.java
  2. 10
    1
      src/main/java/io/zipcoder/persistenceapp/person/Person.java

+ 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(){