Merge pull request #5267 from eugenp/spring-jpa-fix
fix spring-jpa start
This commit is contained in:
commit
5e3eb4ae41
|
@ -78,9 +78,9 @@ public class PersistenceJPAConfig {
|
||||||
final Properties hibernateProperties = new Properties();
|
final Properties hibernateProperties = new Properties();
|
||||||
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
hibernateProperties.setProperty("hibernate.hbm2ddl.auto", env.getProperty("hibernate.hbm2ddl.auto"));
|
||||||
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
hibernateProperties.setProperty("hibernate.dialect", env.getProperty("hibernate.dialect"));
|
||||||
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", env.getProperty("hibernate.cache.use_second_level_cache"));
|
hibernateProperties.setProperty("hibernate.cache.use_second_level_cache", "false");
|
||||||
hibernateProperties.setProperty("hibernate.cache.use_query_cache", env.getProperty("hibernate.cache.use_query_cache"));
|
|
||||||
// hibernateProperties.setProperty("hibernate.globally_quoted_identifiers", "true");
|
|
||||||
return hibernateProperties;
|
return hibernateProperties;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,7 +5,7 @@ import org.springframework.web.servlet.support.AbstractAnnotationConfigDispatche
|
||||||
public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
|
public class WebInitializer extends AbstractAnnotationConfigDispatcherServletInitializer {
|
||||||
@Override
|
@Override
|
||||||
protected Class<?>[] getRootConfigClasses() {
|
protected Class<?>[] getRootConfigClasses() {
|
||||||
return new Class[] { PersistenceJNDIConfig.class };
|
return new Class[] { PersistenceJPAConfig.class };
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package org.baeldung.persistence.criteria.repository;
|
package org.baeldung.persistence.dao;
|
||||||
|
|
||||||
import org.baeldung.persistence.criteria.model.Book;
|
import org.baeldung.persistence.model.Book;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
package org.baeldung.persistence.criteria.repository;
|
package org.baeldung.persistence.dao;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.baeldung.persistence.criteria.model.Book;
|
import org.baeldung.persistence.model.Book;
|
||||||
|
|
||||||
public interface BookRepositoryCustom {
|
public interface BookRepositoryCustom {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.persistence.criteria.dao;
|
package org.baeldung.persistence.dao;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -10,8 +10,7 @@ import javax.persistence.criteria.CriteriaQuery;
|
||||||
import javax.persistence.criteria.Predicate;
|
import javax.persistence.criteria.Predicate;
|
||||||
import javax.persistence.criteria.Root;
|
import javax.persistence.criteria.Root;
|
||||||
|
|
||||||
import org.baeldung.persistence.criteria.model.Book;
|
import org.baeldung.persistence.model.Book;
|
||||||
import org.baeldung.persistence.criteria.repository.BookRepositoryCustom;
|
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
@Repository
|
@Repository
|
|
@ -1,12 +1,12 @@
|
||||||
package org.baeldung.persistence.criteria.repository;
|
package org.baeldung.persistence.dao;
|
||||||
|
|
||||||
import static org.baeldung.persistence.criteria.repository.BookSpecifications.hasAuthor;
|
import static org.baeldung.persistence.dao.BookSpecifications.hasAuthor;
|
||||||
import static org.baeldung.persistence.criteria.repository.BookSpecifications.titleContains;
|
import static org.baeldung.persistence.dao.BookSpecifications.titleContains;
|
||||||
import static org.springframework.data.jpa.domain.Specifications.where;
|
import static org.springframework.data.jpa.domain.Specifications.where;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.baeldung.persistence.criteria.model.Book;
|
import org.baeldung.persistence.model.Book;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@Service
|
@Service
|
|
@ -1,6 +1,6 @@
|
||||||
package org.baeldung.persistence.criteria.repository;
|
package org.baeldung.persistence.dao;
|
||||||
|
|
||||||
import org.baeldung.persistence.criteria.model.Book;
|
import org.baeldung.persistence.model.Book;
|
||||||
import org.springframework.data.jpa.domain.Specification;
|
import org.springframework.data.jpa.domain.Specification;
|
||||||
|
|
||||||
public class BookSpecifications {
|
public class BookSpecifications {
|
|
@ -1,4 +1,4 @@
|
||||||
package org.baeldung.persistence.criteria.model;
|
package org.baeldung.persistence.model;
|
||||||
|
|
||||||
import javax.persistence.Entity;
|
import javax.persistence.Entity;
|
||||||
import javax.persistence.Id;
|
import javax.persistence.Id;
|
|
@ -21,8 +21,6 @@
|
||||||
<props>
|
<props>
|
||||||
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
|
<prop key="hibernate.hbm2ddl.auto">${hibernate.hbm2ddl.auto}</prop>
|
||||||
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
|
||||||
<prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
|
|
||||||
<prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
|
|
||||||
</props>
|
</props>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
Loading…
Reference in New Issue