Question: You are given a spring boot application ( version 2 . 0 . 5 ) with spring - boot - starter - data - jpa
You are given a spring boot application
version
with spring
boot
starter
data
jpa and lombok dependencies.Database access is fully confiugred
h
database is used
The application is compiled using JDK
ArticleDTO, as used the code,is defined as follows:
class ArticleDTO
private String title;
private String content;
private List tags;
Your tasks
Complete the database model that will be used for storing articles.
Articles must be stored in table article, with its tags in a table
named tag.
Register ArticleService as a Spring Bean.
Use ArticleRepository as Spring Data JPA repository and inject it into
ArticleService.
Configure the Article class as a Hibernate entity. It should correspond
to the article table in the database.
Implement a findById method it should return the article with the
given id if it exists in the database, or return an empty article
otherwise.
Implement a findByTitle method it should return list of articles
with title containing given argument
Implement a create method it should insert an article into the
database and return its generated id
Implement an update method that should update an existing article.
If there is no article with the given id you should throw a
RuntimeException with message "Article not found".
Implement a delete method that allows an article to be deleted.
Add validation to the create and update methods check whether
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
