diff --git a/persistence-modules/spring-persistence-simple/README.md b/persistence-modules/spring-persistence-simple/README.md index c656efaa3b..c408ff3c96 100644 --- a/persistence-modules/spring-persistence-simple/README.md +++ b/persistence-modules/spring-persistence-simple/README.md @@ -11,6 +11,7 @@ - [Transactions with Spring and JPA](https://www.baeldung.com/transaction-configuration-with-jpa-and-spring) - [Introduction to Spring Data JPA](http://www.baeldung.com/the-persistence-layer-with-spring-data-jpa) - [Spring Data JPA @Query](http://www.baeldung.com/spring-data-jpa-query) +- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) ### Eclipse Config diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index 5f48b267b5..aa9f9d5029 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -108,6 +108,12 @@ querydsl-apt ${querydsl.version} + + org.hsqldb + hsqldb + ${hsqldb.version} + test + @@ -150,6 +156,7 @@ 9.0.0.M26 1.1 4.2.1 + 2.4.1 21.0 diff --git a/spring-all/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java b/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java similarity index 100% rename from spring-all/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java rename to persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java diff --git a/spring-all/src/main/java/org/baeldung/jdbc/Employee.java b/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/Employee.java similarity index 100% rename from spring-all/src/main/java/org/baeldung/jdbc/Employee.java rename to persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/Employee.java diff --git a/spring-all/src/main/java/org/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeDAO.java similarity index 100% rename from spring-all/src/main/java/org/baeldung/jdbc/EmployeeDAO.java rename to persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeDAO.java diff --git a/spring-all/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java b/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java similarity index 100% rename from spring-all/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java rename to persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java diff --git a/spring-all/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java similarity index 100% rename from spring-all/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java rename to persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/schema.sql b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/schema.sql new file mode 100644 index 0000000000..c86d35cdae --- /dev/null +++ b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/schema.sql @@ -0,0 +1,7 @@ +CREATE TABLE EMPLOYEE +( + ID int NOT NULL PRIMARY KEY, + FIRST_NAME varchar(255), + LAST_NAME varchar(255), + ADDRESS varchar(255), +); \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml new file mode 100644 index 0000000000..5fd2699b41 --- /dev/null +++ b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/springJdbc-config.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/test-data.sql b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/test-data.sql new file mode 100644 index 0000000000..b9ef8fec25 --- /dev/null +++ b/persistence-modules/spring-persistence-simple/src/main/resources/jdbc/test-data.sql @@ -0,0 +1,7 @@ +INSERT INTO EMPLOYEE VALUES (1, 'James', 'Gosling', 'Canada'); + +INSERT INTO EMPLOYEE VALUES (2, 'Donald', 'Knuth', 'USA'); + +INSERT INTO EMPLOYEE VALUES (3, 'Linus', 'Torvalds', 'Finland'); + +INSERT INTO EMPLOYEE VALUES (4, 'Dennis', 'Ritchie', 'USA'); \ No newline at end of file diff --git a/spring-all/src/test/java/org/baeldung/jdbc/EmployeeDAOIntegrationTest.java b/persistence-modules/spring-persistence-simple/src/test/java/org/baeldung/jdbc/EmployeeDAOIntegrationTest.java similarity index 100% rename from spring-all/src/test/java/org/baeldung/jdbc/EmployeeDAOIntegrationTest.java rename to persistence-modules/spring-persistence-simple/src/test/java/org/baeldung/jdbc/EmployeeDAOIntegrationTest.java diff --git a/spring-all/README.md b/spring-all/README.md index b0805e5477..b5e91d8d60 100644 --- a/spring-all/README.md +++ b/spring-all/README.md @@ -33,5 +33,4 @@ The "REST With Spring" Classes: http://bit.ly/restwithspring - [Spring @Primary Annotation](http://www.baeldung.com/spring-primary) - [Spring Events](https://www.baeldung.com/spring-events) - [Spring Null-Safety Annotations](https://www.baeldung.com/spring-null-safety-annotations) -- [Spring JDBC](https://www.baeldung.com/spring-jdbc-jdbctemplate) - [Using @Autowired in Abstract Classes](https://www.baeldung.com/spring-autowired-abstract-class)