Skip to content

Commit 8c4585b

Browse files
neerajnydpivovarit
authored andcommitted
Bael 1873 - Spring Data JPA Composable repository (eugenp#4953)
* Merging into own fork (eugenp#3) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database * BAEL-1985: Added Examples showing how to Initialize HashSet when it's constructed (eugenp#4715) * Added Class for Initalizing HahsSet * Updated Class name * Delete InitializingSetTest.java * Copy list to another list examples (eugenp#4725) * Update README.MD (eugenp#4720) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database (eugenp#4728) * [BAEL-7645] - Fixed integration test of spring-jpa module through H2 inmemory DB * BAEL-1814 Guide to Spring Webflux (eugenp#4450) * BAEL-1814 Guide to Spring Webflux -Added files for Employee reactive application -Updated pom.xml for Spring Security * BAEL-1814 Guide to Spring Webflux -Added EmployeeControllerTest -Updated method name in EmployeeController and corrected secured url in EmployeeWebSecurityConfig * BAEL-1814 Guide to spring webflux -Fixed security config, now only specific url prompts for authentication and not all endpoints -Removed @WithMockUser as it is not needed now * BAEL-1814 Guide To Webflux -Feedback incorporation * BAEL-1814 Spring Webflux Guide -Formatted coded for EmployeeWebSocketHandler. * Update and rename EmployeeControllerTest.java to EmployeeControllerUnitTest.java * BAEL-1814 Guide to spring webflux -Fixed EmployeeControllerUnitTest.java * BAEL - 1916 (eugenp#4729) Code refactored * Renamed test methods to use BDD style * Fixed integration test of spring-jpa module through inmemory H2 DB (eugenp#4740) * [BAEL-7621] - Fixed integration test of spring-hibernate-5 module by introducing H2 database * [BAEL-7645] - Fixed integration test of spring-jpa module through H2 inmemory DB * guide to jmapper * [BAEL-7651] - Fixed integration tests of spring-security-mvc-custom module by adding proper authentication manager * clean only generated files * added spring-rest-hal-browser code (eugenp#4701) * Added spring-rest-template * Updated README.md file * Updated README.md file * Update Makefile * Update Makefile * moved AuthenticationFailureHandler example to spring-security-mvc-login * trying out separate modules in the integration profile * maven cleanup * fixing name of module * running group 2 * running group 1 * fixing relative path * Update Makefile * Update Makefile * Update JMapperIntegrationTest.java * Update JMapperRelationalIntegrationTest.java * Update MultipartFileUploadClient.java * BAEL-1914 refactor (eugenp#4749) * Server Sent Events example using Spring Webflux and React * spring security custom AuthenticationFailureHandler * refactor * moved SSE to branch * remove pom properties * moved AuthenticationFailureHandler example to spring-security-mvc-login * added link * trying out profile-driven build * minor maven cleanup * activating group 2 * Update README.md * BAEL-1850 (eugenp#4744) * Micronaut server * More server stuff; create client and test * Rename directory, new concerete client example * Remove hello-world directory from micronaut * Update MavenWrapperDownloader.java * running group 1, and small logging fix * jnosql * live test properly categorized * temporarily making a test live * moving the libraries module from group 1 * group 2 * enabling group 3 * * Added changes for BAEL-1922 Enable CORS in Spring Webflux (eugenp#4724) * BAEL-2018 (eugenp#4753) * BAEL-2018 * Update Animal.java * rename * running group 3 * jmeter excluded * running group 2 * properly classifying a testclear * live tests * BAEL-1838 (eugenp#4692) * #BAEL-1838 code samples. Renamed LambdaKotlinTest to have the build succeed. * #BAEL-1838 code samples w/inheritance. * #BAEL-1838 renamed logger helper function to getLogger to avoid confusion. * #BAEL-1838 renamed logger helper function to getLogger to avoid confusion. * BEAL-1985 - Removed Java 9 Example (eugenp#4734) * Added Class for Initalizing HahsSet * Updated Class name * Delete InitializingSetTest.java * Modified HashSet Initilization Example * Removed Java 9 Example * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * Update HashSetInitalizingUnitTest.java * group 3.2 * enabling 3.1 * running group 3 * Update README.md Documenting the new default profile. * fixing the default profile testing config * groups 2 and 3 * minor major cleanup * BAEL-1907 Created new module spring-testing * new integration-lite profile * integration-lite work * BAEL-1862 Move the Junit 5 logic in the right module (eugenp#4747) * BAEL-1862 Move the Junit 5 logic in the right module -Moved Method Orders Tests from tutorails/junit5 project into correct project tutorials/testing-modules/junit-5 -Removed tutorials/junit5 project * Update DefaultOrderOfExecutionTest.java * Update README.md * BAEL-1862 Move the Junit 5 logic in the right module -Renamed *Test to *UnitTest * Update README.md * maven cleanup work * logging cleanup * BAEL-1907 Corrected formatting * working through modules * maven cleanup * trying problematic modules * integration heavy profile * maven work * Bael 1864 (eugenp#4727) * running project without building tests * include the DataCheck class * Update TestFail.java * guide to jmapper (eugenp#4745) * guide to jmapper * Update JMapperIntegrationTest.java * Update JMapperRelationalIntegrationTest.java * dupirefr/dupire.francois+pro@gmail.com [BAEL-1981] Query entities by dates and times with Spring Data JPA (eugenp#4737) * [BAEL-1981] Article entity and repository + tests * [BAEL-1981] Removing unnecessary fields * moving long-running module * BAEL-1992 * maven cleanup work * BAEL-1818 - A Guide to Connection Pools in Java (eugenp#4735) * Strange git issue with README.MD, wouldn't revert the file * Initial Commit * Initial Commit * Update pom.xml * Update pom.xml * Initial Commit * Update pom.xml * Update source files * Update source files * Update source files * Update source files * Update Application.java * Update pom.xml * Update HikariCPDataSourceUnitTest class * Update HikariCPDataSourceUnitTest.java * Update pom.xml * Update unit test classes * Update BasicConnectionPoolUnitTest.java * Fix indentation in DBCDDataSource class * Update DBCPDataSource.java * Update BasicConnectionPool class * Update BasicConnectionPool class * Update BasicConnectionPool.java * Update BasicConnectionPool.java * Update pom.xml * Update pom.xml * BAEL-1818 Refactored getConnection(), added shutdown(), cleaned up pom.xml * BAEL-1818 Removed getConnectionPool(), upgraded c3po version * BAEL-1818 Deleted obsolete connectionpool module * BAEL-1818 Deleted obsolete connectionpool module * move jmapper to libraries-data * [BAEL-7635] Removed test generated files : Will be gitignored * [BAEL-7635] - Commented out sortpom-maven-plugin that changes pom.xml in every build, added new entries in .gitignore * BAEL-1852 - Testing an Abstract Class with JUnit (eugenp#4773) * BAEL-1852 - Testing an Abstract Class with JUnit * Fixed test method names and class names according to naming compliances. * BAEL-1934 (eugenp#4768) * Bean Object, server side and client side example for event streaming example * BAEL-1628 Access a File from the Classpath in a Spring Application * inputstream retrieval added * Removed files related to evaluation article * + Aligning code to the article. Removed Utility methods and classes * BAEL - 1628 * PMD fixes * Code Review changes Refactored : whenResourceUtils_thenReadSuccessful * BAEL-1934 * +indentation correction in pom.xml * synced with master * indentation correction * update to spring 5 * Bael 2018 (eugenp#4774) * BAEL-2018 * Update Animal.java * rename * tests added * generic type shorten * update test * BAEL-1911 - Fixing author's review comments (eugenp#4782) * Strange git issue with README.MD, wouldn't revert the file * Fixing review comments * BAEL-1911 Refactored SQL code, fixed formatting * fix swagger parent * Update pom.xml * Update pom.xml * Overriding System time for testing (eugenp#4779) * Overriding System time for testing * Remove Joda Date Time examples * BAEL-1728: add java instrumentation * dupirefr/dupire.francois+pro@gmail.com [BAEL-1981] Spring data jpa dates (eugenp#4795) * [BAEL-1981] Article entity and repository + tests * [BAEL-1981] Removing unnecessary fields * [BAEL-1981] spring-data-jpa module creation * BAEL-1818 lamdba instead of loop; isEmpty() instead of == 0 (eugenp#4791) * BAEL-2018 Moved to core-java-collections (eugenp#4796) * BAEL-1691: comparing embedded servlet containers in spring boot * vaadin spring * format * remove reactive ex * move to reactive, extract mongodb ex * PR for http://jira.baeldung.com/browse/BAEL-1947 Spring Boot Vue (eugenp#4687) * commit first as binodpanta * revert test change * A short example of real-time event streaming using Spring WebFlux * Code for http://jira.baeldung.com/browse/BAEL-1527 * remove unrelated files * Apply feedback changes to rename test and remove link from readme file, ongoing work * Update formatting fixes to code and add pom changes, that partially fix test runnning issues in IDE but not in cmdline * Apply Eclipse formatter to test code and apply suggested pom fixes * BAEL-1527 Formatting fix in pom.xml * Use string.format to cleanup logging code * BAEL-1527 Changed logging pattern * Start the spring-boot-vue module, WIP * some small updates with comments * Add index html template page * merge pom.xml fixes * Add integration test with MockMvc to verify index.html content is rendered correctly * fix up pom merge issues * merge issues fix for pom * pom end of file newline * Update README.md * Update README.md (eugenp#4706) * add links (eugenp#4804) * Update README.md * Update README.md * Update README.md * Update README.md * Create README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.MD * Create README.md * Update README.md * Update README.md * Update README.md * Update README.md * Update README.md * move mongodb ex * fix readme files * Bael 1832 (eugenp#4748) * @primary annotation * @primary annotation Employee name * Update PrimaryApplication.java * @primary annotation with @component * add security exc * added readme * added link * BAEL-2030 remove first element from list (eugenp#4803) * BAEL-2042 JavaFaker unit tests * Moved javafaker unit tests to testing-modules * Update PushController.java * * added examples of filtering collections using Streams, Apache CollectionUtils, Guava and Eclipse Collections * * Added examples for java-9 filtering collector * * minor fixes and cleaning duties * add elements to list (eugenp#4814) * BAEL-1960: Custom appender for log4j (eugenp#4731) * BAEL-1960: Custom appender for log4j * Changes as per suggestion to BAEL-1960 * Changes as [er review for BAEL-1960 * Changes for formatting as per suggestion. * BAEL-1960. Copied pom.xml from master and pasted my changes against it. * Chnages for spaces instead of tabs. * Changes for spaces instead of tabs. * PrincipalExtractor and AuthoritiesExtractor example * Bael 1743 improved (eugenp#4826) * compile only for firefox * added parent module * changed artifact id * commenting out problematic modules in the integration-lite build * integratio-lite profile work * integration-lite work * update spring data elasticsearch * BAEL-1818 A Simple Guide to Connection Pooling in Java (eugenp#4823) * Initial Commit * Update parent pom.xml * Update BasicConnectionPool class * Update BasicConnectionPool class * BAEL-1818 removed code from core-java module, cleaned up a little pom files * BAEL-1818 moved the code from connectionpool.connectionpools package to connectionpool * added link * integration-lite trying out a few modules * moved PrincipalExtractor and AuthoritiesExtractor example to spring-5-security module * removed comment on pom * [refs#BAEL-1992] Minor refactoring * BAEL-1983 Intialize a HashMap in Java (eugenp#4819) * move mqtt project * added link * Add items to list in core-java-collections (eugenp#4841) * [BAEL-7608] - Fixed spring-5-reactive integration tests * [BAEL-7608] - Reverted NettyContext to Embedded Tomcat example with Async = true * [BAEL-7608] - Removed unused imports * Update pom.xml * [BAEL-7609] - Fixed spring-boot integration tests * Added PR files for BAEL-2031 (eugenp#4844) * Added source files for BAEL-2031 * Added test files for BAEL-2031 * upgrade sockets to spring5 * BAEL-1979 Added examples for SnakeYAML Library (eugenp#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * [BAEL-7608] - Fixed SecurityIntegrationTest with redirecting to login * Bael 1555 - Improve Example (eugenp#4852) * BAEL-1555 * Corrected indents and spacing * RequestMapping to GetMapping * Improved Performance For Concurrent Users * BAEL-1958 Log using SLF4J (eugenp#4790) * Log using SLF4J Jira Ticket: BAEL-1958 * Incorporate first review comments * Bael 2023 (eugenp#4851) * bael-2023: removing all occurrences of a value from a list * adjusting examples to match the article * [BAEL-7437] - Added spring tx dependency to fix spring-mvc-simple junit 5 TCs * add libraries server project * remove extra files * BAEL-1865 - Java Objects Sizes (eugenp#4584) * BAEL-1865 - Java Objects Sizes * BAEL-1865 - PR fix * OAuth2 Principal and Authorities example - refactor and added example using custom authorization server * Server-Sent Evensts * BAEL-1936 Use of FilenameFilter (eugenp#4520) * Added tests for FilenameFilter demo -added a test to show FilenameFilter implementation -added another test to show similar functionality using Predicate * refactored code to get directory at a single location * fixing formatting * changed test class name to conform to custom rule UnitTestNamingConventionRule lists the allowed test class names. Added ManualTest at the end to conform to the rule. * add new module * Update pom.xml (eugenp#4843) * BAEL-1861 - Running JUnit tests from a Java application (eugenp#4526) * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * BAEL-1562 - Thymeleaf sample working * BAEL-1562 Code added for Fragments sample * BAEL-1562 - Last correction for the test * Updates Thymeleaf version to 3.0.9.RELEASE * Added msf4j projects * updated msf4j project folder * fixed issue with spring-thymeleaf/pom.xml * Removed depedency-reduced-pom.xml * Whitespacing fix * Strange git issue with README.MD, wouldn't revert the file * Added jupiter api * Corrected junit test * Added test engine to plugin * Removed extra tag * Little fixes to junit4 and junit4 run from java * Removed scope from pom.xml * Removed bin file from testing * Slight changes for PMD * Slight changes for PMD * ok, moved code to another folder * Renamed and fixed runjunitfromjava * moved test classes to test folder * moved main to src/java * BAEL-1861 Moved test running classes to src/test/java * Added changes to runjunitfromjava * Added changes to runjunitfromjava * BAEL-1861 Changed test execution code examples * BAEL-1861 Changed test execution code examples; formatting * Bael 1852 - Test case code is aligned to support Junit5 (eugenp#4847) * add prototype bean ex with function * remove extra classes * remove extra import * separate configs * separate configs * Update AppConfig.java * Code update to support Junit5 * BAEL-1979 Added examples for SnakeYAML Library (eugenp#4802) * BAEL-1979 Added examples for SnakeYAML Library * BAEL-1979 Moved the snakeyaml related code to libraries module * BAEL-1979 Removed the System.out.println() statements and converted the assertTrue to assertEquals wherever possible. * BAEL-1979 Removed println statements, small formatting fix in pom.xml * BAEL-1852 Renamed one test method, fixed formatting * Bael 1273 Spring RSS Feed View (eugenp#4707) * Added example for BAEL-1273 - rss feed with Spring. * Fixed javadoc * Removed useless SpringBootServletInitializer in RSS app's launcher * Explicitely added Spring Boot starting class in pom.xml to prevent errors in package phase. * Adding files for Exception Handling article (eugenp#4507) * Adding files for Exception Handling article * Updating files * Test folder * testing renaming * Formatting and Naming Conventions This commit reworks the code for the Intro to Exception Handling article, ensuring that packages and classes are formatted and named according to site standards. * Update SseEmitterController.java (eugenp#4864) * fixing package hierarchy (*.list.list.listoflist -> *.list.listoflist) (eugenp#4879) * moved examples for 'removing all occurrences of an element from a list' to core-java-collections (eugenp#4878) * BAEL-1958 Moved the example to logging-modules (eugenp#4886) * Example for removing first element of array (BAEL-2029) (eugenp#4836) * Example for removing first element of array (BAEL-2029) * Use AssertJ assertions * BAEL-1986 List initialization in one line (eugenp#4696) * list initializations in one line * Enhance after review * formatting and naming * Formatting and renaming 2 * Unit tests and DequeBasedSynchronizedStack added up * Unit tests method names and class names modified as per the guidelines * BAEL-1840 Builder Pattern in Kotlin (eugenp#4730) * builder pattern in kotlin * builder pattern in kotlin new-line * deleted Sandbox, added unit test * add other tests * named and default parameters builder * Make FoodOrderNamed a data class * BAEL-1861 Replaced real tests with demo test "placeholders" (eugenp#4887) * Spring Boot and Angular E-Commerce Application (eugenp#4874) * Spring Boot and Angular E-Commerce Application * Spring Boot and Angular E-Commerce Application pom.xml updated * Spring Boot and Angular E-Commerce Application tests added * BAEL-7965 JMH module fails when build (eugenp#4888) * BAEL-7965 JMH module fails when build -Added jmh module in default profile in parent pom * Update pom.xml moved jmh module to integration profile * Create pom.xml * Create FunctionTestSuite.java BAEL-1857 * BAEL-1857 Running Parallel JUnit Tests with Maven * BAEL-1901 and BAEL-1555 add links (eugenp#4892) * BAEL-1766: Update README * BAEL-1853: add link to article * BAEL-1801: add link to article * Added links back to articles * Add links back to articles * BAEL-1795: Update README * BAEL-1901 and BAEL-1555 add links back to article * [BAEL-1967] - Custom validation MessageSource in Spring Boot * POM file updated for BAEL-1967 * BAEL-1704: Non-Trivial Work in Kotlin vs Java (eugenp#4861) * BAEL-1704: Non-Trivial Work in Kotlin vs Java * BAEL-1704: Non-Trivial Work in Kotlin vs Java Renaming one test class * Bael 1964 (eugenp#4881) * Added initial code for BAEL-1964, in-memory authentication application * Switched to default security encoder instead of a specific one * Fix typo (eugenp#4897) * add new module * fix typo * [BAEL-7670] Added logback.xml in missing modules in src/main/resources * Spring Data JPA Composable repository
1 parent 9bb3310 commit 8c4585b

16 files changed

Lines changed: 512 additions & 4 deletions
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package com.baeldung.domain;
2+
3+
import java.math.BigDecimal;
4+
5+
import javax.persistence.Entity;
6+
import javax.persistence.Id;
7+
import javax.persistence.ManyToOne;
8+
9+
@Entity
10+
public class Item {
11+
12+
private String color;
13+
private String grade;
14+
15+
@Id
16+
private Long id;
17+
18+
@ManyToOne
19+
private ItemType itemType;
20+
21+
private String name;
22+
private BigDecimal price;
23+
@ManyToOne
24+
private Store store;
25+
26+
public String getColor() {
27+
return color;
28+
}
29+
30+
public String getGrade() {
31+
return grade;
32+
}
33+
34+
public Long getId() {
35+
return id;
36+
}
37+
38+
public ItemType getItemType() {
39+
return itemType;
40+
}
41+
42+
public String getName() {
43+
return name;
44+
}
45+
46+
public BigDecimal getPrice() {
47+
return price;
48+
}
49+
50+
public Store getStore() {
51+
return store;
52+
}
53+
54+
public void setColor(String color) {
55+
this.color = color;
56+
}
57+
58+
public void setGrade(String grade) {
59+
this.grade = grade;
60+
}
61+
62+
public void setId(Long id) {
63+
this.id = id;
64+
}
65+
66+
public void setItemType(ItemType itemType) {
67+
this.itemType = itemType;
68+
}
69+
70+
public void setName(String name) {
71+
this.name = name;
72+
}
73+
74+
public void setPrice(BigDecimal price) {
75+
this.price = price;
76+
}
77+
78+
public void setStore(Store store) {
79+
this.store = store;
80+
}
81+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
package com.baeldung.domain;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import javax.persistence.CascadeType;
7+
import javax.persistence.Entity;
8+
import javax.persistence.Id;
9+
import javax.persistence.JoinColumn;
10+
import javax.persistence.OneToMany;
11+
12+
@Entity
13+
public class ItemType {
14+
15+
@Id
16+
private Long id;
17+
@OneToMany(cascade = CascadeType.ALL)
18+
@JoinColumn(name = "ITEM_TYPE_ID")
19+
private List<Item> items = new ArrayList<>();
20+
21+
private String name;
22+
23+
public Long getId() {
24+
return id;
25+
}
26+
27+
public List<Item> getItems() {
28+
return items;
29+
}
30+
31+
public String getName() {
32+
return name;
33+
}
34+
35+
public void setId(Long id) {
36+
this.id = id;
37+
}
38+
39+
public void setItems(List<Item> items) {
40+
this.items = items;
41+
}
42+
43+
public void setName(String name) {
44+
this.name = name;
45+
}
46+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package com.baeldung.domain;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import javax.persistence.CascadeType;
7+
import javax.persistence.Entity;
8+
import javax.persistence.Id;
9+
import javax.persistence.JoinColumn;
10+
import javax.persistence.OneToMany;
11+
12+
@Entity
13+
public class Location {
14+
15+
private String city;
16+
private String country;
17+
@Id
18+
private Long id;
19+
20+
@OneToMany(cascade = CascadeType.ALL)
21+
@JoinColumn(name = "LOCATION_ID")
22+
private List<Store> stores = new ArrayList<>();
23+
24+
public String getCity() {
25+
return city;
26+
}
27+
28+
public String getCountry() {
29+
return country;
30+
}
31+
32+
public Long getId() {
33+
return id;
34+
}
35+
36+
public List<Store> getStores() {
37+
return stores;
38+
}
39+
40+
public void setCity(String city) {
41+
this.city = city;
42+
}
43+
44+
public void setCountry(String country) {
45+
this.country = country;
46+
}
47+
48+
public void setId(Long id) {
49+
this.id = id;
50+
}
51+
52+
public void setStores(List<Store> stores) {
53+
this.stores = stores;
54+
}
55+
}
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
package com.baeldung.domain;
2+
3+
import java.util.ArrayList;
4+
import java.util.List;
5+
6+
import javax.persistence.CascadeType;
7+
import javax.persistence.Entity;
8+
import javax.persistence.Id;
9+
import javax.persistence.JoinColumn;
10+
import javax.persistence.ManyToOne;
11+
import javax.persistence.OneToMany;
12+
13+
@Entity
14+
public class Store {
15+
16+
private Boolean active;
17+
@Id
18+
private Long id;
19+
@OneToMany(cascade = CascadeType.ALL)
20+
@JoinColumn(name = "STORE_ID")
21+
private List<Item> items = new ArrayList<>();
22+
private Long itemsSold;
23+
24+
@ManyToOne
25+
private Location location;
26+
27+
private String name;
28+
29+
public Boolean getActive() {
30+
return active;
31+
}
32+
33+
public Long getId() {
34+
return id;
35+
}
36+
37+
public List<Item> getItems() {
38+
return items;
39+
}
40+
41+
public Long getItemsSold() {
42+
return itemsSold;
43+
}
44+
45+
public Location getLocation() {
46+
return location;
47+
}
48+
49+
public String getName() {
50+
return name;
51+
}
52+
53+
public void setActive(Boolean active) {
54+
this.active = active;
55+
}
56+
57+
public void setId(Long id) {
58+
this.id = id;
59+
}
60+
61+
public void setItems(List<Item> items) {
62+
this.items = items;
63+
}
64+
65+
public void setItemsSold(Long itemsSold) {
66+
this.itemsSold = itemsSold;
67+
}
68+
69+
public void setLocation(Location location) {
70+
this.location = location;
71+
}
72+
73+
public void setName(String name) {
74+
this.name = name;
75+
}
76+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.baeldung.repository;
2+
3+
import org.springframework.stereotype.Repository;
4+
5+
import com.baeldung.domain.Item;
6+
7+
@Repository
8+
public interface CustomItemRepository {
9+
10+
void deleteCustom(Item entity);
11+
12+
Item findItemById(Long id);
13+
14+
void findThenDelete(Long id);
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.repository;
2+
3+
import org.springframework.stereotype.Repository;
4+
5+
import com.baeldung.domain.ItemType;
6+
7+
@Repository
8+
public interface CustomItemTypeRepository {
9+
10+
void deleteCustom(ItemType entity);
11+
12+
void findThenDelete(Long id);
13+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.baeldung.repository;
2+
3+
import org.springframework.data.jpa.repository.JpaRepository;
4+
import org.springframework.stereotype.Repository;
5+
6+
import com.baeldung.domain.ItemType;
7+
8+
@Repository
9+
public interface ItemTypeRepository extends JpaRepository<ItemType, Long>, CustomItemTypeRepository, CustomItemRepository {
10+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package com.baeldung.repository;
2+
3+
import org.springframework.data.jpa.repository.JpaRepository;
4+
import org.springframework.stereotype.Repository;
5+
6+
import com.baeldung.domain.Location;
7+
8+
@Repository
9+
public interface LocationRepository extends JpaRepository<Location, Long> {
10+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package com.baeldung.repository;
2+
3+
import java.util.Optional;
4+
5+
import org.springframework.data.repository.Repository;
6+
7+
import com.baeldung.domain.Location;
8+
9+
@org.springframework.stereotype.Repository
10+
public interface ReadOnlyLocationRepository extends Repository<Location, Long> {
11+
12+
Optional<Location> findById(Long id);
13+
14+
Location save(Location location);
15+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.baeldung.repository;
2+
3+
import java.util.List;
4+
5+
import org.springframework.data.jpa.repository.JpaRepository;
6+
import org.springframework.stereotype.Repository;
7+
8+
import com.baeldung.domain.Store;
9+
10+
@Repository
11+
public interface StoreRepository extends JpaRepository<Store, Long> {
12+
List<Store> findStoreByLocationId(Long locationId);
13+
}

0 commit comments

Comments
 (0)