Skip to content

This Java Spring Boot web services project, utilizing JPA and Hibernate, aims to deliver a robust CRUD application with H2 database integration, showcasing effective domain modeling, layered architecture, and comprehensive exception handling, while emphasizing seamless deployment options, including Heroku integration and PostgreSQL support.

Notifications You must be signed in to change notification settings

marialuizaleitao/webservice-springboot3-jpa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Web Services Project with Spring Boot and JPA / Hibernate

This is a Java Spring Boot project that implements a Web Services system using JPA (Java Persistence API) and Hibernate. The main goal is to create an application with CRUD (Create, Retrieve, Update, Delete) functionalities, exception handling, and layered architecture.

Technologies Used

  • Spring Boot: A framework to simplify configuration and development of Java applications.
  • Spring Web: A module of the Spring Framework for creating web applications.
  • Spring Data JPA: Eases the implementation of JPA-based repositories.
  • Hibernate: An object-relational mapping framework for Java.
  • H2 Database: An in-memory database for testing.
  • Java 17: The primary programming language.
  • Maven: A dependency management tool.

Application Features

Domain Model

image

image

Logical Layers

image

Checklist

  • Spring Initializr: Used to configure the project with Maven, Java 17, and JAR packaging, along with the Spring Web dependency.
  • User Entity and Resource: Implementation of the User entity with basic attributes, associations, constructors, getters, setters, hashCode, equals, and serialization.
  • H2 Database, Test Profile, and JPA: Configuration of the H2 database for testing, test profile in the application.properties file, and JPA mapping for entities.
  • JPA Repository, Dependency Injection, and Database Seeding: Use of UserRepository for CRUD operations, dependency injection, and seeding the database with users.
  • Service Layer and Component Registration: Implementation of the service layer and registration of Spring components.
  • New Order Entity: Implementation of the Order entity with associations and JPA mapping.
  • Order Status Enumeration, Category, and Product: Implementation of entities related to orders, categories, and products.
  • Many-to-Many Association with JoinTable and One-to-Many Association: Implementation of associations between Order and Product.
  • One-to-One Association with Payment: Implementation of the association between Order and Payment.
  • Methods for Order Subtotal and Total: Implementation of methods to calculate order subtotal and total.
  • User Insertion, Deletion, and Update: Implementation of services and resources for inserting, deleting, and updating users.
  • Exception Handling: Implementation of exception handling for user retrieval, deletion, and update operations.

How to Run the Project

  1. Clone this repository.
  2. Import the project into your preferred IDE (recommended: IntelliJ IDEA, Eclipse).
  3. Ensure that Java 17 and Maven are installed on your machine.
  4. Run the project as a Spring Boot application.

Test Examples

User Insertion

{
 "name": "Fernando Alonso",
 "email": "[email protected]",
 "phone": "977557733",
 "password": "123456"
}

User Update

{
 "name": "Fernando Alonso",
 "email": "[email protected]",
 "phone": "977557714"
}

Contributing

Contributions are welcome! If you encounter any issues or have suggestions, please open an issue in this repository.

About

This Java Spring Boot web services project, utilizing JPA and Hibernate, aims to deliver a robust CRUD application with H2 database integration, showcasing effective domain modeling, layered architecture, and comprehensive exception handling, while emphasizing seamless deployment options, including Heroku integration and PostgreSQL support.

Topics

Resources

Stars

Watchers

Forks

Languages