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
Database
to a Spring Application - Persist
Employers
andSkills
- Set up a
One-to-Many
Relationship - Set up a
Many-to-Many
Relationship
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
Employer
andSkill
- Do they contain the correct fields, correct accessors, correct validation annotations, constructors, and persistence. - The Data Layer - Do
EmployerRepository
andSkillRepository
exisit? 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.jobs
has been properly defined and annotatedAbstractEntity
has been properly extended- Many-to-one pattern created between
Job.employer
andEmployer
HomeController
has an autowiredEmployerRepository
is able to callemployerRepository.findALL()
.- SQL test to drop a table
TestTaskFour
verifies the following:
Skill.jobs
exists as a type List and has a many-to-many relationshipJob.skills
has been refactored to aList<Skills>
Skills
has been properly refactored with correct accessorsHomeController
has aSkillRepository
, and can handle a formListController
has 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_id
column in it.b. Confirm that a mapped table is present for
job_skills
and that at least two rows are now in it for the job just created.
To submit your work please follow the Submission Instructions