Skip to content

Java Spring Boot app with Spring Data JPA and H2 Database

Notifications You must be signed in to change notification settings

alexbraga/jpa-repository

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

JPA Repository

Java Spring Boot API with Spring Data JPA and H2 Database

GitHub last commit

Status: Finished

AboutFeaturesHow it worksTech StackHow to contributeAuthor

About

An API written in Java with Spring Boot and Spring Data JPA to query for information on users. The database chosen is the in-memory H2 Database, for testing and demonstration purposes.


Features

  • Structure divided into Entities, Repositories and Controllers
  • Pageable results
  • Query parameters for filtering between values
  • Classes and objects
  • Encapsulation, getters and setters
  • Object-Relational Mapping

How it works

  1. Clone this repository
  2. Run the application
  3. API Endpoints

Pre-requisites

Before getting started, you'll need to have the following tools installed on your machine:

In addition, you might also want an IDE to work with the code, like IntelliJ IDEA.

Clone this repository

git clone https://github.com/alexbraga/jpa-repository.git

Running the application

Navigate to the root directory of the project

cd jpa-repository

Build the project

mvn compile

Run the application

mvn spring-boot:run
  • Alternatively, open the project with your preferred IDE and run /src/main/java/com/example/jparepository/JpaRepositoryApplication.java
  • The server will start at localhost:8080

API Endpoints

  • Get all users in the database:

    • GET /users
  • Get all users, with pageable results:

    • GET /users/page?page={page_number}&size={size}
  • Search users by salary range:

    • GET /users/search-salary?minSalary={min_value}&maxSalary={max_value}
  • Search users by name:

    • GET /users/search-name?name={user_name}

Tech Stack

The following tools were used in the construction of the project:

Language

Framework

Dependencies

  • Spring Web
  • Spring Data JPA
  • H2 Database

See the file pom.xml

Utilities


How to contribute

  1. Fork the project
  2. Create a new branch with your changes:
git checkout -b my-amazing-feature
  1. Save your changes and create a commit message (in present tense) telling what you did:
git commit -m "Add my amazing feature"
  1. Submit your changes:
git push origin my-amazing-feature
  1. Create a pull request

Author

Alexandre Braga

LinkedIn  E-Mail

About

Java Spring Boot app with Spring Data JPA and H2 Database

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages