For this assignment students are tested for their understanding of SQL database management and the mechanics of object relational mapping. Students will demonstrate their knowledge of these topics by making updates again to the TechJobs application. They will be asked to create the database connection, finish what has been started to persist several model classes, create a one-to-many and a many-to-many relationship between objects, and answer a few simple SQL questions.
Grading will be done via demonstrations. Students will be asked to give a walkthrough of their source code, as well as the running application.
- Connect a
Databaseto a Spring Application - Persist
EmployersandSkills - Set up a
One-to-ManyRelationship - Set up a
Many-to-ManyRelationship
The starter code contains 6 unit test classes.
TestTaskOne verifies two things:
- Connection between database and data
- Correct gradle dependencies have been added
TestTaskTwo has over 25 tests and covers all of Part 2. If this class of tests fails, students need to carefully explore the test results for where an error occured.
This test class verifies the following:
AbstractEntity- Does it exisit? How does it handle names and IDs?- Model Tests such as
EmployerandSkill- Do they contain the correct fields, correct accessors, correct validation annotations, constructors, and persistence. - The Data Layer - Do
EmployerRepositoryandSkillRepositoryexisit? Do theese repos implement CrudRepository? - Controller Tests - Do EmployerController.index and SkillController.index route properly? Does it properly handle data inputs, routing,
findAll()andfindById()methods, and storing data? - SQL Tests - Can it select based on name?
TestTaskThree verifies the following:
Employer.jobshas been properly defined and annotatedAbstractEntityhas been properly extended- Many-to-one pattern created between
Job.employerandEmployer HomeControllerhas an autowiredEmployerRepositoryis able to callemployerRepository.findALL().- SQL test to drop a table
TestTaskFour verifies the following:
Skill.jobsexists as a type List and has a many-to-many relationshipJob.skillshas been refactored to aList<Skills>Skillshas been properly refactored with correct accessorsHomeControllerhas aSkillRepository, and can handle a formListControllerhas autowired repos, can set field data- A SQL test that creates a join.
TestCommentedTests verifies that the correct number of tests have been uncommented.
Before you start coding, check out our Working Demo App. The app occasionally restarts, so if you experience any issues, please wait a few minutes before refreshing the page.
Use the checks below to explore the working app.
-
Start the application and navigate to the Add Job view.
-
Create a new employer from the form and view the resulting object in the employer table.
-
Create at least two new skills from the form and view the objects in the skill table.
-
Create a new Job from the form, selecting at least two skills.
a. Once created, view the job table and verify that there is an
employer_idcolumn in it.b. Confirm that a mapped table is present for
job_skillsand that at least two rows are now in it for the job just created.
To submit your work please follow the Submission Instructions