David Ginzberg 7 年 前
コミット
b047dea4c0
共有1 個のファイルを変更した11 個の追加6 個の削除を含む
  1. 11
    6
      README.md

+ 11
- 6
README.md ファイルの表示

@@ -68,9 +68,6 @@ Create the following REST endpoints to interact with the application. You can us
68 68
  - `GET` `/people/surname` -- Get the result of the surname report above
69 69
  - `GET` `/people/firstname/stats` -- Get the report of first name frequencies
70 70
  
71
- 
72
- 
73
- 
74 71
 #### Homes and People 
75 72
 There is another table in the data base named home that consist of the following
76 73
 fields:
@@ -94,22 +91,21 @@ Add the following homes to the 'HOME' table
94 91
 _You may use the query in the 'data-h2.sql' file to populate the 'PERSON' and 'HOME' table_
95 92
 
96 93
 
97
-
98 94
 Support the following operations:
95
+
99 96
 - Add a "Home" to the database
100 97
 - Add a person to a home 
101 98
 - Update an existing 'Home' in the database
102 99
 - Remove a home from the database
103 100
 - Remove a list of homes from the database
104 101
 - Find a home by id
105
-- Find a hom by home number
102
+- Find a home by home number
106 103
 - Find a home by address
107 104
 - Find a home by person id
108 105
 - Generate a list of people that live in a home
109 106
 
110 107
 
111 108
 
112
-
113 109
 List all of the homes that have more that one person that live there. Group people by the home that they 
114 110
 live in 
115 111
 
@@ -122,5 +118,14 @@ Create a query to update a person's 'HOMENUMBER"
122 118
 Find the home number of John Smith
123 119
 
124 120
 
121
+## Part 3: JPA
122
+ 
123
+In this section we're going to re-create our service class using JPA. 
124
+
125
+Start by breaking your `PersonService` class into an interface and implementation eg: `interface PersonService` and `class jdbcPersonServiceImpl`. Place the `@Service` annotation on the implementation class.
126
+
127
+Now create a new class that implements the PersonService, this time with JPA. Once you annotate this class with @Service you will get an error when you start spring -- you can fix this by annotation the service you want to use with `@Primary` -- This tells Spring that if there are multiple beans competing for autowiring, the one marked with `@Primary` should be used (this won't work if multiple competing beans are marked `@Primary`
125 128
 
129
+Implement all of the methods found in your `PersonService` interface in this new JPA-based service. You won't have to change your controller at all if you are autowiring a reference to a `PersonService` - Spring will automatically inject the `@Primary`-annotated implementation of `PersonService`
126 130
 
131
+Remember that you won't be using the Jdbc service or any `JdbcTemplate` objects in this part of the lab.