From a6ea78aa471631e2b89f28d2e0b5a4e6b61da154 Mon Sep 17 00:00:00 2001 From: vunamtien Date: Fri, 29 Mar 2024 17:26:43 +0700 Subject: [PATCH] [JAVA-29082] Split-or-move-spring-data-jpa-repo-module (#16252) * [JAVA-29082] Split-or-move-spring-data-jpa-repo-module * [JAVA-29082] Split-or-move-spring-data-jpa-repo-module --- persistence-modules/spring-data-jpa-repo-2/README.md | 2 ++ .../storedprocedure/StoredProcedureApplication.java | 2 +- .../storedprocedure/controller/CarController.java | 9 ++++----- .../data/persistence}/storedprocedure/entity/Car.java | 2 +- .../storedprocedure/repository/CarRepository.java | 7 +++---- .../persistence}/storedprocedure/service/CarService.java | 9 ++++----- .../src/main/resources/car-mysql.sql | 0 persistence-modules/spring-data-jpa-repo/README.md | 1 - 8 files changed, 15 insertions(+), 17 deletions(-) rename persistence-modules/{spring-data-jpa-repo/src/main/java/com/baeldung => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence}/storedprocedure/StoredProcedureApplication.java (83%) rename persistence-modules/{spring-data-jpa-repo/src/main/java/com/baeldung => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence}/storedprocedure/controller/CarController.java (86%) rename persistence-modules/{spring-data-jpa-repo/src/main/java/com/baeldung => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence}/storedprocedure/entity/Car.java (93%) rename persistence-modules/{spring-data-jpa-repo/src/main/java/com/baeldung => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence}/storedprocedure/repository/CarRepository.java (87%) rename persistence-modules/{spring-data-jpa-repo/src/main/java/com/baeldung => spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence}/storedprocedure/service/CarService.java (81%) rename persistence-modules/{spring-data-jpa-repo => spring-data-jpa-repo-2}/src/main/resources/car-mysql.sql (100%) diff --git a/persistence-modules/spring-data-jpa-repo-2/README.md b/persistence-modules/spring-data-jpa-repo-2/README.md index 8c588405f7..d377104c02 100644 --- a/persistence-modules/spring-data-jpa-repo-2/README.md +++ b/persistence-modules/spring-data-jpa-repo-2/README.md @@ -7,4 +7,6 @@ - [Difference Between JPA and Spring Data JPA](https://www.baeldung.com/spring-data-jpa-vs-jpa) - [Differences Between Spring Data JPA findFirst() and findTop()](https://www.baeldung.com/spring-data-jpa-findfirst-vs-findtop) - [Difference Between findBy and findAllBy in Spring Data JPA](https://www.baeldung.com/spring-data-jpa-find-by-vs-find-all-by) +- [Calling Stored Procedures from Spring Data JPA Repositories](https://www.baeldung.com/spring-data-jpa-stored-procedures) + - More articles: [[<-- prev]](../spring-data-jpa-repo) diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/StoredProcedureApplication.java similarity index 83% rename from persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/StoredProcedureApplication.java index 5f05764e21..0100beec55 100644 --- a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/StoredProcedureApplication.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/StoredProcedureApplication.java @@ -1,4 +1,4 @@ -package com.baeldung.storedprocedure; +package com.baeldung.spring.data.persistence.storedprocedure; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/controller/CarController.java similarity index 86% rename from persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/controller/CarController.java index 6aef600d01..6a12e4e93b 100644 --- a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/controller/CarController.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/controller/CarController.java @@ -1,14 +1,13 @@ -package com.baeldung.storedprocedure.controller; - -import java.util.List; +package com.baeldung.spring.data.persistence.storedprocedure.controller; +import com.baeldung.spring.data.persistence.storedprocedure.entity.Car; +import com.baeldung.spring.data.persistence.storedprocedure.service.CarService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; -import com.baeldung.storedprocedure.entity.Car; -import com.baeldung.storedprocedure.service.CarService; +import java.util.List; @RestController public class CarController { diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/entity/Car.java similarity index 93% rename from persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/entity/Car.java index 0a61a16e24..53f1d8557e 100644 --- a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/entity/Car.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/entity/Car.java @@ -1,4 +1,4 @@ -package com.baeldung.storedprocedure.entity; +package com.baeldung.spring.data.persistence.storedprocedure.entity; import jakarta.persistence.Column; import jakarta.persistence.Entity; diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/repository/CarRepository.java similarity index 87% rename from persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/repository/CarRepository.java index 3d9428628e..9366a86445 100644 --- a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/repository/CarRepository.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/repository/CarRepository.java @@ -1,14 +1,13 @@ -package com.baeldung.storedprocedure.repository; - -import java.util.List; +package com.baeldung.spring.data.persistence.storedprocedure.repository; +import com.baeldung.spring.data.persistence.storedprocedure.entity.Car; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.jpa.repository.query.Procedure; import org.springframework.data.repository.query.Param; import org.springframework.stereotype.Repository; -import com.baeldung.storedprocedure.entity.Car; +import java.util.List; @Repository public interface CarRepository extends JpaRepository { diff --git a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/service/CarService.java similarity index 81% rename from persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java rename to persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/service/CarService.java index 104f46e324..ff2a20601e 100644 --- a/persistence-modules/spring-data-jpa-repo/src/main/java/com/baeldung/storedprocedure/service/CarService.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/storedprocedure/service/CarService.java @@ -1,12 +1,11 @@ -package com.baeldung.storedprocedure.service; - -import java.util.List; +package com.baeldung.spring.data.persistence.storedprocedure.service; +import com.baeldung.spring.data.persistence.storedprocedure.entity.Car; +import com.baeldung.spring.data.persistence.storedprocedure.repository.CarRepository; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import com.baeldung.storedprocedure.entity.Car; -import com.baeldung.storedprocedure.repository.CarRepository; +import java.util.List; @Service public class CarService { diff --git a/persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql b/persistence-modules/spring-data-jpa-repo-2/src/main/resources/car-mysql.sql similarity index 100% rename from persistence-modules/spring-data-jpa-repo/src/main/resources/car-mysql.sql rename to persistence-modules/spring-data-jpa-repo-2/src/main/resources/car-mysql.sql diff --git a/persistence-modules/spring-data-jpa-repo/README.md b/persistence-modules/spring-data-jpa-repo/README.md index f404263159..ffbd57d7f6 100644 --- a/persistence-modules/spring-data-jpa-repo/README.md +++ b/persistence-modules/spring-data-jpa-repo/README.md @@ -8,7 +8,6 @@ This module contains articles about repositories in Spring Data JPA - [Spring Data JPA – Adding a Method in All Repositories](https://www.baeldung.com/spring-data-jpa-method-in-all-repositories) - [Spring Data Composable Repositories](https://www.baeldung.com/spring-data-composable-repositories) - [Spring Data JPA Repository Populators](https://www.baeldung.com/spring-data-jpa-repository-populators) -- [Calling Stored Procedures from Spring Data JPA Repositories](https://www.baeldung.com/spring-data-jpa-stored-procedures) - [LIKE Queries in Spring JPA Repositories](https://www.baeldung.com/spring-jpa-like-queries) - More articles: [[--> next]](../spring-data-jpa-repo-2)