diff --git a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/springdatajpadifference/springdata/config/SpringDataJpaConfig.java b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/springdatajpadifference/springdata/config/SpringDataJpaConfig.java index 57f9d2981f..923e923c88 100644 --- a/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/springdatajpadifference/springdata/config/SpringDataJpaConfig.java +++ b/persistence-modules/spring-data-jpa-repo-2/src/main/java/com/baeldung/spring/data/persistence/springdatajpadifference/springdata/config/SpringDataJpaConfig.java @@ -16,6 +16,7 @@ import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter; import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.annotation.EnableTransactionManagement; +import com.baeldung.spring.data.persistence.springdatajpadifference.model.Employee; import com.baeldung.spring.data.persistence.springdatajpadifference.springdata.repository.EmployeeRepository; import com.querydsl.jpa.impl.JPAQueryFactory; @@ -28,7 +29,8 @@ public class SpringDataJpaConfig { public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean em = new LocalContainerEntityManagerFactoryBean(); em.setDataSource(dataSource); - em.setPackagesToScan("com.baeldung.spring.data.persistence.springdata_jpa_difference.model"); + em.setPackagesToScan(Employee.class.getPackage() + .getName()); JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter(); em.setJpaVendorAdapter(vendorAdapter);