Skip to content

This is the sample project for join table by using spring data jpa

Notifications You must be signed in to change notification settings

yewin-mm/spring-data-jpa-join-table-example

Repository files navigation

Contributors Forks Stargazers Issues LinkedIn

Overview

spring-data-jpa-join-table-example

  • This is the sample backend microservice project for join table by using spring data jpa.

Table of Contents

About The Project

This is the sample backend microservice project for join table by using spring data jpa. You can learn how to connect and join two table by using spring data jpa.

Built With

This project is built with

Getting Started

This project is built with java, maven, postgresql and use project lombok as plugin. So, please make sure all are installed in your machine.

Before you begin

If you are new in Git, Github and new in Spring Boot configuration structure,
You should see basic details instruction first in here Spring Boot Application Instruction
If you are not good enough in basic JPA CRUD knowledge with Java Spring Boot, you should learn below example projects first.
Click below links.

If you already knew above links and you have good enough basic knowledge with Java Spring Boot, you can keep learn this project and see the "Instruction" below.

Clone Project

  • Clone the repo
    git clone https://github.com/yewin-mm/spring-data-jpa-join-table-example.git
    

Prerequisites

Prerequisites can be found in here Spring Boot Application Instruction.

Instruction

  • Change your database username and password in application.properties.

  • Run the project in your IDE. Please make sure application was successfully running.

  • You can check in your database is that there has 'Role and User' table were auto created or not, under postgres schema by database GUI tools like DBeaver.

  • Insert some data into 'Role' table in your database by querying in database console.

  • Find 'Role' table under postgres schema which will auto create by running application.

  • If you can't find, just click refresh and see again under postgres schema.

  • You can add by clicking '+' sign in your 'Role' table or you can run below query in DBeaver console (please go Execute SQL Statement in your DBeaver) like

    insert into role (id, role_name) values (1, 'admin'); insert into role (id, role_name) values (2, 'normal user');
    
  • Import jpa-join-table-example-postman-api-request.json file under project directory (see that file in project directory) into your installed Postman application.

    • Click in your Postman (top left corner) import -> file -> upload files -> {choose that json file} and open/import.
    • After that, you can see the folder which you import from file in your Postman.
  • Now, you can 'Test' this project by calling API from Postman.

    • Open your imported folder in postman and inside this folder, you will see total of 3 API requests and you can test it all by clicking Send button and see the response.
    • Before testing, please make sure some data should be in Role table first.
    • You can check data in database too (here you can check data in tables (User, Role) by DBeaver tools or you can manually select query in your database console)
  • After that you can see the code and check the code which you don't know. You can learn it and you can apply in your job or study fields.

Have Fun and Enjoy in Learning Code

✉️ Contact Me

Name - Ye Win
LinkedIn profile - Ye Win
Email Address - yewin.mmr@gmail.com
WhatsApp - +959252656065
Website - My Website

Project Link: Spring Data JPA Join Table Example

🥰 Becoming a Sponsor

If you like any of my projects or if you want to support my work, please kindly consider becoming a sponsor.
It gives me great motivation and I can relentlessly maintain my projects and contribute to the open-source community.

Buy Me A Coffee

⭐ Contributing

Contributions are what make the open source community such an amazing place to be learnt, inspire, and create. Any contributions you make are greatly appreciated.
If you want to contribute....

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/yourname)
  3. Commit your Changes (git commit -m 'Add some AmazingFeatures')
  4. Push to the Branch (git push -u origin feature/yourname)
  5. Open a Pull Request

About

This is the sample project for join table by using spring data jpa

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages