{"id":24021207,"url":"https://github.com/zipcodecore/jpa-lab","last_synced_at":"2025-09-07T14:34:45.609Z","repository":{"id":147837747,"uuid":"107658285","full_name":"ZipCodeCore/JPA-Lab","owner":"ZipCodeCore","description":null,"archived":false,"fork":false,"pushed_at":"2023-02-09T15:35:23.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-08T12:41:27.896Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ZipCodeCore.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-10-20T09:22:03.000Z","updated_at":"2023-02-09T15:35:27.000Z","dependencies_parsed_at":null,"dependency_job_id":"f85af4a5-ba06-4981-aa8b-619fec90cdfc","html_url":"https://github.com/ZipCodeCore/JPA-Lab","commit_stats":null,"previous_names":[],"tags_count":0,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FJPA-Lab","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FJPA-Lab/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FJPA-Lab/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ZipCodeCore%2FJPA-Lab/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ZipCodeCore","download_url":"https://codeload.github.com/ZipCodeCore/JPA-Lab/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240766672,"owners_count":19854114,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-08T12:39:58.222Z","updated_at":"2025-02-25T23:47:14.395Z","avatar_url":"https://github.com/ZipCodeCore.png","language":"Java","readme":"# JPA Lab\nThis lab has the same goals of the JDBC AddressingPeople lab, but using JPA.\n\nThe setup for the database stuff is the same as in the JDBC lab, so see the README from that lab for getting connected \nto the database in case you forgot.  The `data-h2.sql` file is here again, too.  \nThis will give you some cases to test against.  Feel free to add your own stuff and to modify that SQL file.  \nIt's here to help you out.\n\n## Step 0 -- Getting Set Up\nThe scaffolding has been done for the first part for you.  Since one of the hardest, most daunting parts of creating \nsoftware is just starting, all of the interfaces have been built out and everything to\ncreate a person has been completed.  We've started for you!  Now, you don't have to worry about imports and package\nstructures.  Just start coding.  You'll have to do all of these things yourself for the second part, however.  So\nfirst read through what's happening and understand why everything is there.  If you forget what's going on you can also \nlook back at the Spring lab for some help.\n\nAs far as the project structure is concerned:\n* The controllers are how we interface our software with the outside world.  They define what the user can ask us for\nand how it all gets returned.\n* The models are the actual data structures that we want to represent.  In this case, we need Persons and Homes.\n* The repositories are where all the database logic actually happens.\n    * Spring JPA handles most of this for us, though.\n* The services are what call the repositories and do the actual computation requested by the controllers.\n\n## Step 1 -- People\nFor this first part, we want to handle Creating, Reading, Updating, and Deleting people from our database.  The schema\nis in the `resources/schema-h2.sql` file, and you can view it in the H2 console as well.\n\nWe need our application to adhere to the following API:\n\n|HTTP Method|Endpoint|What It Does|\n|-|-|-|\n|POST|/people|Create a person|\n|PUT|/people/{id}|Update person with id. 404 error if that person doesn't exist yet|\n|GET|/people/{id}|Get the person with the specified ID|\n|DELETE|/people/{id}|Delete the person with the specified ID|\n|GET|/people|get all people in the database|\n|GET|/people/reverselookup/{mobileNumber}|Find all people with the specified mobile number|\n|GET|/people/surname/{lastName}|Find all people with a particular last name|\n|GET|/people/surname/stats|Get the report of all the last name frequencies (Name, Count)|\n|GET|/people/firstname/stats|Get the report of first name frequencies (Name, Count)|\n|GET|/people/birthday/stats|Get the report of all the birthday frequencies (Date, Count)|\n\n\nIn addition to those endpoints, we're going to want our service to be able to:\n* Remove a list of people from the database\n* Find everyone with a particular first name.\n* Find everyone with a particular birthday.\n\nI know it might seem weird to have these in the service without the controller calling them, but this is very common\nwhen writing software.  A lot of times you're going to want internal service calls that can do things that you don't\nwant to expose to the end user.\n\nAlso, remember that you can \"test\" your services with a unit test like we did with the Pluralsight walkthrough.\n\n## Step 2 -- Homes\nRemember how we didn't do much with the `homes` part of the data.  We left the `home_id` null for a person and we also\nnever made any references to that table?  Well, now it's time to do that.\n\nRemember, you're going to need a controller, model, repository, and service for the homes.  We want to be able to:\n\n* Add a home to the database\n* Add a person to a home\n* Remove a person from a home\n* Update an existing home\n* Delete a home from the database\n* Delete a list of homes from the database\n* Find a home by id\n* Find a home by home number\n* Find a home by address\n* Find a home by person\n* Get a list of people who live in a certain home\n* Get all of the homes\n\nNotice when you try and get things that don't exist in the database we get an error?  \nFix that.  Just make it so that requesting an item doesn't return anything as opposed to throwing the exception.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fjpa-lab","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzipcodecore%2Fjpa-lab","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzipcodecore%2Fjpa-lab/lists"}