Explorar el Código

fixed annotations in entities

mpierse hace 5 años
padre
commit
e25dca761b

+ 11
- 0
src/main/java/io/zipcoder/persistenceapp/home/Home.java Ver fichero

1
 package io.zipcoder.persistenceapp.home;
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
 public class Home {
9
 public class Home {
4
 
10
 
11
+    @Id
12
+    @GeneratedValue
13
+    @Column(name = "id")
5
     private Long id;
14
     private Long id;
15
+    @Column(name = "address")
6
     private String address;
16
     private String address;
17
+    @Column(name = "homenumber")
7
     private String homenumber;
18
     private String homenumber;
8
 
19
 
9
     public Home(){}
20
     public Home(){}

+ 10
- 1
src/main/java/io/zipcoder/persistenceapp/person/Person.java Ver fichero

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