From cbac5e3e765a706c5739d9ea66d69b695d7301ab Mon Sep 17 00:00:00 2001 From: Loredana Date: Sat, 18 May 2019 15:34:01 +0300 Subject: [PATCH] BAEL-12937 --- .../spring-persistence-simple/pom.xml | 13 ------------- .../baeldung/config/PersistenceConfig.java | 10 +++++----- .../baeldung/config/PersistenceJPAConfig.java | 8 ++++---- .../dao/impl => hibernate/dao}/FooDao.java | 6 +++--- .../baeldung/jdbc/CustomSQLErrorCodeTranslator.java | 4 ++-- .../java/{org => com}/baeldung/jdbc/Employee.java | 2 +- .../{org => com}/baeldung/jdbc/EmployeeDAO.java | 2 +- .../baeldung/jdbc/EmployeeRowMapper.java | 2 +- .../baeldung/jdbc/config/SpringJdbcConfig.java | 6 +++--- .../baeldung/jpa}/dao/AbstractJpaDAO.java | 2 +- .../baeldung/jpa}/dao/FooDao.java | 4 ++-- .../baeldung/jpa}/dao/IFooDao.java | 4 ++-- .../persistence/dao/common/GenericJpaDao.java | 3 ++- .../baeldung/persistence/model/Bar.java | 2 +- .../baeldung/persistence/model/Foo.java | 2 +- .../baeldung/persistence/service/FooService.java | 6 +++--- .../data/persistence/config/PersistenceConfig.java | 8 ++++---- .../spring/data/persistence/dao/IFooDao.java | 4 ++-- .../data/persistence/dao/user/UserRepository.java | 4 ++-- .../persistence/dao/user/UserRepositoryCustom.java | 4 ++-- .../dao/user/UserRepositoryCustomImpl.java | 4 ++-- .../baeldung/spring/data/persistence/model/Foo.java | 2 +- .../spring/data/persistence/model/Possession.java | 2 +- .../spring/data/persistence/model/User.java | 2 +- .../data/persistence/service/IFooService.java | 4 ++-- .../persistence/service/common/AbstractService.java | 2 +- .../data/persistence/service/impl/FooService.java | 10 +++++----- .../java/{org => com}/baeldung/util/IDUtil.java | 2 +- .../src/main/resources/jdbc/springJdbc-config.xml | 2 +- .../src/main/resources/persistence.xml | 2 +- .../main/resources/springDataPersistenceConfig.xml | 2 +- .../baeldung/jdbc/EmployeeDAOIntegrationTest.java | 4 ++-- .../FooPaginationPersistenceIntegrationTest.java | 6 +++--- .../FooServicePersistenceIntegrationTest.java | 6 +++--- .../service/FooServiceSortingIntegrationTest.java | 8 ++++---- ...ServiceSortingWitNullsManualIntegrationTest.java | 6 +++--- .../service/FooStoredProceduresLiveTest.java | 6 +++--- .../persistence/dao/user/UserRepositoryCommon.java | 6 +++--- .../dao/user/UserRepositoryIntegrationTest.java | 6 +++--- .../AbstractServicePersistenceIntegrationTest.java | 6 +++--- .../FooServicePersistenceIntegrationTest.java | 6 +++--- 41 files changed, 89 insertions(+), 101 deletions(-) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/config/PersistenceConfig.java (93%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/config/PersistenceJPAConfig.java (93%) rename persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/{persistence/dao/impl => hibernate/dao}/FooDao.java (69%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/jdbc/CustomSQLErrorCodeTranslator.java (88%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/jdbc/Employee.java (96%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/jdbc/EmployeeDAO.java (99%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/jdbc/EmployeeRowMapper.java (95%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/jdbc/config/SpringJdbcConfig.java (84%) rename persistence-modules/spring-persistence-simple/src/main/java/{org/baeldung/persistence => com/baeldung/jpa}/dao/AbstractJpaDAO.java (96%) rename persistence-modules/spring-persistence-simple/src/main/java/{org/baeldung/persistence => com/baeldung/jpa}/dao/FooDao.java (73%) rename persistence-modules/spring-persistence-simple/src/main/java/{org/baeldung/persistence => com/baeldung/jpa}/dao/IFooDao.java (74%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/persistence/model/Bar.java (98%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/persistence/model/Foo.java (98%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/persistence/service/FooService.java (81%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/config/PersistenceConfig.java (93%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/dao/IFooDao.java (77%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/dao/user/UserRepository.java (97%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java (72%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java (94%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/model/Foo.java (96%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/model/Possession.java (97%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/model/User.java (98%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/service/IFooService.java (58%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/service/common/AbstractService.java (95%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/spring/data/persistence/service/impl/FooService.java (70%) rename persistence-modules/spring-persistence-simple/src/main/java/{org => com}/baeldung/util/IDUtil.java (96%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/jdbc/EmployeeDAOIntegrationTest.java (98%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/persistence/service/FooPaginationPersistenceIntegrationTest.java (97%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/persistence/service/FooServicePersistenceIntegrationTest.java (94%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/persistence/service/FooServiceSortingIntegrationTest.java (96%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/persistence/service/FooServiceSortingWitNullsManualIntegrationTest.java (94%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/persistence/service/FooStoredProceduresLiveTest.java (97%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/spring/data/persistence/dao/user/UserRepositoryCommon.java (99%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/spring/data/persistence/dao/user/UserRepositoryIntegrationTest.java (89%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/spring/data/persistence/service/AbstractServicePersistenceIntegrationTest.java (98%) rename persistence-modules/spring-persistence-simple/src/test/java/{org => com}/baeldung/spring/data/persistence/service/FooServicePersistenceIntegrationTest.java (93%) diff --git a/persistence-modules/spring-persistence-simple/pom.xml b/persistence-modules/spring-persistence-simple/pom.xml index aa9f9d5029..1afacab164 100644 --- a/persistence-modules/spring-persistence-simple/pom.xml +++ b/persistence-modules/spring-persistence-simple/pom.xml @@ -18,12 +18,6 @@ org.springframework spring-orm ${org.springframework.version} - - - commons-logging - commons-logging - - org.springframework @@ -108,12 +102,6 @@ querydsl-apt ${querydsl.version} - - org.hsqldb - hsqldb - ${hsqldb.version} - test - @@ -156,7 +144,6 @@ 9.0.0.M26 1.1 4.2.1 - 2.4.1 21.0 diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java similarity index 93% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceConfig.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java index c454ab3b54..569971e311 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceConfig.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceConfig.java @@ -1,11 +1,10 @@ -package org.baeldung.config; +package com.baeldung.config; import java.util.Properties; import javax.sql.DataSource; import org.apache.tomcat.dbcp.dbcp2.BasicDataSource; -import org.baeldung.persistence.dao.IFooDao; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; @@ -24,15 +23,16 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; -import com.baeldung.persistence.dao.impl.FooDao; +import com.baeldung.hibernate.dao.FooDao; +import com.baeldung.jpa.dao.IFooDao; import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement -@EnableJpaRepositories(basePackages = { "com.baeldung.persistence" }, transactionManagerRef = "jpaTransactionManager") +@EnableJpaRepositories(basePackages = { "com.baeldung.hibernate.dao" }, transactionManagerRef = "jpaTransactionManager") @EnableJpaAuditing @PropertySource({ "classpath:persistence-mysql.properties" }) -@ComponentScan({ "com.baeldung.persistence" }) +@ComponentScan({ "com.baeldung.persistence", "com.baeldung.hibernate.dao" }) public class PersistenceConfig { @Autowired diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceJPAConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java similarity index 93% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceJPAConfig.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java index ec0d4bca3c..9fae34d99e 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/config/PersistenceJPAConfig.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/config/PersistenceJPAConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.config; +package com.baeldung.config; import java.util.Properties; @@ -25,8 +25,8 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-h2.properties" }) -@ComponentScan({ "org.baeldung.persistence" }) -@EnableJpaRepositories(basePackages = "org.baeldung.persistence.dao") +@ComponentScan({ "com.baeldung.persistence","com.baeldung.jpa.dao" }) +@EnableJpaRepositories(basePackages = "com.baeldung.jpa.dao") public class PersistenceJPAConfig { @Autowired @@ -42,7 +42,7 @@ public class PersistenceJPAConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.persistence.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter); diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java similarity index 69% rename from persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java index 2d940527e1..67c10fe7fe 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/impl/FooDao.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/hibernate/dao/FooDao.java @@ -1,9 +1,9 @@ -package com.baeldung.persistence.dao.impl; +package com.baeldung.hibernate.dao; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.stereotype.Repository; +import com.baeldung.jpa.dao.IFooDao; import com.baeldung.persistence.dao.common.AbstractHibernateDao; @Repository diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java similarity index 88% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java index 8a02fe6a53..48ddfb04b1 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/CustomSQLErrorCodeTranslator.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/CustomSQLErrorCodeTranslator.java @@ -1,4 +1,4 @@ -package org.baeldung.jdbc; +package com.baeldung.jdbc; import java.sql.SQLException; @@ -10,7 +10,7 @@ public class CustomSQLErrorCodeTranslator extends SQLErrorCodeSQLExceptionTransl @Override protected DataAccessException customTranslate(final String task, final String sql, final SQLException sqlException) { - if (sqlException.getErrorCode() == -104) { + if (sqlException.getErrorCode() == 23505) { return new DuplicateKeyException("Custome Exception translator - Integrity contraint voilation.", sqlException); } return null; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/Employee.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java similarity index 96% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/Employee.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java index e9408eb7fa..a43eb265c7 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/Employee.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/Employee.java @@ -1,4 +1,4 @@ -package org.baeldung.jdbc; +package com.baeldung.jdbc; public class Employee { private int id; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeDAO.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java similarity index 99% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeDAO.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java index 1f0e7b28ad..9ba4ebdb6d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeDAO.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeDAO.java @@ -1,4 +1,4 @@ -package org.baeldung.jdbc; +package com.baeldung.jdbc; import java.sql.PreparedStatement; import java.sql.SQLException; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java similarity index 95% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java index f926836c40..d09cd45dbc 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/EmployeeRowMapper.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/EmployeeRowMapper.java @@ -1,4 +1,4 @@ -package org.baeldung.jdbc; +package com.baeldung.jdbc; import java.sql.ResultSet; import java.sql.SQLException; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java similarity index 84% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java index f7eb592366..ddc24e439f 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/jdbc/config/SpringJdbcConfig.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jdbc/config/SpringJdbcConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.jdbc.config; +package com.baeldung.jdbc.config; import javax.sql.DataSource; @@ -10,12 +10,12 @@ import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder; import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType; @Configuration -@ComponentScan("org.baeldung.jdbc") +@ComponentScan("com.baeldung.jdbc") public class SpringJdbcConfig { @Bean public DataSource dataSource() { - return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.HSQL).addScript("classpath:jdbc/schema.sql").addScript("classpath:jdbc/test-data.sql").build(); + return new EmbeddedDatabaseBuilder().setType(EmbeddedDatabaseType.H2).addScript("classpath:jdbc/schema.sql").addScript("classpath:jdbc/test-data.sql").build(); } // @Bean diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java similarity index 96% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java index decca35c08..4fbc8464bb 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/AbstractJpaDAO.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/AbstractJpaDAO.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.dao; +package com.baeldung.jpa.dao; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/FooDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java similarity index 73% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/FooDao.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java index 77978c5cf2..e79a44a0c2 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/FooDao.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/FooDao.java @@ -1,6 +1,6 @@ -package org.baeldung.persistence.dao; +package com.baeldung.jpa.dao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; import org.springframework.stereotype.Repository; @Repository diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/IFooDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java similarity index 74% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/IFooDao.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java index ba188b9b3a..8140c56edd 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/dao/IFooDao.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/jpa/dao/IFooDao.java @@ -1,8 +1,8 @@ -package org.baeldung.persistence.dao; +package com.baeldung.jpa.dao; import java.util.List; -import org.baeldung.persistence.model.Foo; +import com.baeldung.persistence.model.Foo; public interface IFooDao { diff --git a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java index 5bcebed761..d4da194f4d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/dao/common/GenericJpaDao.java @@ -2,11 +2,12 @@ package com.baeldung.persistence.dao.common; import java.io.Serializable; -import org.baeldung.persistence.dao.AbstractJpaDAO; import org.springframework.beans.factory.config.BeanDefinition; import org.springframework.context.annotation.Scope; import org.springframework.stereotype.Repository; +import com.baeldung.jpa.dao.AbstractJpaDAO; + @Repository @Scope(BeanDefinition.SCOPE_PROTOTYPE) public class GenericJpaDao extends AbstractJpaDAO implements IGenericDao { diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Bar.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java similarity index 98% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Bar.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java index b602e57562..5a88ecc6cf 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Bar.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Bar.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Foo.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java similarity index 98% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Foo.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java index 30635e9ef2..009876f8cb 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/model/Foo.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.persistence.model; +package com.baeldung.persistence.model; import java.io.Serializable; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/service/FooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java similarity index 81% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/service/FooService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java index 6d1bb0adbe..efe9743670 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/persistence/service/FooService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/persistence/service/FooService.java @@ -1,9 +1,9 @@ -package org.baeldung.persistence.service; +package com.baeldung.persistence.service; import java.util.List; -import org.baeldung.persistence.dao.IFooDao; -import org.baeldung.persistence.model.Foo; +import com.baeldung.jpa.dao.IFooDao; +import com.baeldung.persistence.model.Foo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/config/PersistenceConfig.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java similarity index 93% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/config/PersistenceConfig.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java index 067bac2018..717b9c3aa0 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/config/PersistenceConfig.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/config/PersistenceConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.config; +package com.baeldung.spring.data.persistence.config; import java.util.Properties; @@ -24,9 +24,9 @@ import com.google.common.base.Preconditions; @Configuration @EnableTransactionManagement @PropertySource({ "classpath:persistence-${envTarget:h2}.properties" }) -@ComponentScan({ "org.baeldung.spring.data.persistence" }) +@ComponentScan({ "com.baeldung.spring.data.persistence" }) // @ImportResource("classpath*:springDataPersistenceConfig.xml") -@EnableJpaRepositories(basePackages = "org.baeldung.spring.data.persistence.dao") +@EnableJpaRepositories(basePackages = "com.baeldung.spring.data.persistence.dao") public class PersistenceConfig { @Autowired @@ -40,7 +40,7 @@ public class PersistenceConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory() { final LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource()); - em.setPackagesToScan(new String[] { "org.baeldung.spring.data.persistence.model" }); + em.setPackagesToScan(new String[] { "com.baeldung.spring.data.persistence.model" }); final HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); // vendorAdapter.set diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/IFooDao.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/IFooDao.java similarity index 77% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/IFooDao.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/IFooDao.java index 2f74096e14..d2b746dc8b 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/IFooDao.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/IFooDao.java @@ -1,6 +1,6 @@ -package org.baeldung.spring.data.persistence.dao; +package com.baeldung.spring.data.persistence.dao; -import org.baeldung.spring.data.persistence.model.Foo; +import com.baeldung.spring.data.persistence.model.Foo; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepository.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepository.java similarity index 97% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepository.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepository.java index 4d01376af7..e8f95302ef 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepository.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepository.java @@ -1,11 +1,11 @@ -package org.baeldung.spring.data.persistence.dao.user; +package com.baeldung.spring.data.persistence.dao.user; import java.time.LocalDate; import java.util.Collection; import java.util.List; import java.util.stream.Stream; -import org.baeldung.spring.data.persistence.model.User; +import com.baeldung.spring.data.persistence.model.User; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Sort; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java similarity index 72% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java index 1a874fb5e5..ff92159077 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustom.java @@ -1,11 +1,11 @@ -package org.baeldung.spring.data.persistence.dao.user; +package com.baeldung.spring.data.persistence.dao.user; import java.util.Collection; import java.util.List; import java.util.Set; import java.util.function.Predicate; -import org.baeldung.spring.data.persistence.model.User; +import com.baeldung.spring.data.persistence.model.User; public interface UserRepositoryCustom { List findUserByEmails(Set emails); diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java similarity index 94% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java index c28050401c..8bd8217e83 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/dao/user/UserRepositoryCustomImpl.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.dao.user; +package com.baeldung.spring.data.persistence.dao.user; import java.util.ArrayList; import java.util.Collection; @@ -15,7 +15,7 @@ import javax.persistence.criteria.Path; import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Root; -import org.baeldung.spring.data.persistence.model.User; +import com.baeldung.spring.data.persistence.model.User; public class UserRepositoryCustomImpl implements UserRepositoryCustom { diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Foo.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java similarity index 96% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Foo.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java index 8f316ac55b..64bfe203d0 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Foo.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Foo.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.model; +package com.baeldung.spring.data.persistence.model; import java.io.Serializable; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Possession.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java similarity index 97% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Possession.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java index da64e78552..44ca9fc62e 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/Possession.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/Possession.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.model; +package com.baeldung.spring.data.persistence.model; import javax.persistence.Entity; import javax.persistence.GeneratedValue; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/User.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java similarity index 98% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/User.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java index 486ed046e5..09f1092644 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/model/User.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/model/User.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.model; +package com.baeldung.spring.data.persistence.model; import javax.persistence.*; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/IFooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java similarity index 58% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/IFooService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java index 26d0171551..00e7ac01e4 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/IFooService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/IFooService.java @@ -1,6 +1,6 @@ -package org.baeldung.spring.data.persistence.service; +package com.baeldung.spring.data.persistence.service; -import org.baeldung.spring.data.persistence.model.Foo; +import com.baeldung.spring.data.persistence.model.Foo; import com.baeldung.persistence.dao.common.IOperations; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/common/AbstractService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java similarity index 95% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/common/AbstractService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java index cf28d5e5c6..61c7d6fcaa 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/common/AbstractService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/common/AbstractService.java @@ -1,4 +1,4 @@ -package org.baeldung.spring.data.persistence.service.common; +package com.baeldung.spring.data.persistence.service.common; import java.io.Serializable; import java.util.List; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/impl/FooService.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java similarity index 70% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/impl/FooService.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java index b7ed496df1..cd566ba9f6 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/spring/data/persistence/service/impl/FooService.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/spring/data/persistence/service/impl/FooService.java @@ -1,10 +1,10 @@ -package org.baeldung.spring.data.persistence.service.impl; +package com.baeldung.spring.data.persistence.service.impl; -import org.baeldung.spring.data.persistence.model.Foo; -import org.baeldung.spring.data.persistence.dao.IFooDao; -import org.baeldung.spring.data.persistence.service.IFooService; -import org.baeldung.spring.data.persistence.service.common.AbstractService; +import com.baeldung.spring.data.persistence.model.Foo; +import com.baeldung.spring.data.persistence.dao.IFooDao; +import com.baeldung.spring.data.persistence.service.IFooService; +import com.baeldung.spring.data.persistence.service.common.AbstractService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.repository.PagingAndSortingRepository; import org.springframework.stereotype.Service; diff --git a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/util/IDUtil.java b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java similarity index 96% rename from persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/util/IDUtil.java rename to persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java index 85ab623e5f..45e72e046d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/java/org/baeldung/util/IDUtil.java +++ b/persistence-modules/spring-persistence-simple/src/main/java/com/baeldung/util/IDUtil.java @@ -1,4 +1,4 @@ -package org.baeldung.util; +package com.baeldung.util; import java.util.Random; 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 index 5fd2699b41..e3d7452eb1 100644 --- 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 @@ -4,7 +4,7 @@ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.2.xsd" > - + diff --git a/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml b/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml index 6304fa0a65..57687c306d 100644 --- a/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml +++ b/persistence-modules/spring-persistence-simple/src/main/resources/persistence.xml @@ -11,7 +11,7 @@ - +