Skip to content

zekeriyafince/SpringHibernateTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hibernate and Spring Task Solution

You are working on a system that helps to manage tasks on a todo list. Your job is to implement an endpoint that allows these tasks to be updated. In order to archieve this, you should use the Hibernate and Spring frameworks.

Application

You are given a Spring Boot application with spring-boot-starter-data-jpa and spring-boot-starter-web modules included. Database access is fully configured. The application is compiled using JDK 8.

Database

Tasks are stored in a relational database. The DB schema looks like this:

CREATE TABLE task(
	id bigint NOT NULL,
	description varchar(200) NOT NULL,
	priority bigint,
	PRIMARY KEY(id)
);

Endpoint

Sending a request:

PUT api/tasks/{id}

with request body:

{
	"description":"task's description",
	"priority":5
}

should update the description and priority of the tash eith id=ID. Changes should be stored in the database.

Tasks

  • Configure the Task class as a Hibernate entity
  • Implement an endpoint as described above. Furthermore, it should meet the following requirements:
    • Endpoint should return error code 404 if a task with the given id does not exist. In response, the server should return following JSON:
       {
       	"message":"Cannot find task with given id",
       	"status":404
       }
    • Endpoint should return error code 400 if a task description is null(or key "description" is not present in the request JSON). In response, the server should return following JSON:
       {
       	"message":"Task description is required",
       	"status":400
       }
    • Endpoint should return error code 200 when the task is succesfully updated. The response body should be the same as the request body, for example:
       {
       	"description":"task's description",
       	"priority":5
       }

Installation

First clone the project.

git clone https://github.com/zekeriyafince/SpringHibernateTask

Contributing

Pull requests are accepted. For major changes, please open a thread to discuss what you want to change first.

About

Hibernate and Spring Task Solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages