Try with this:
@Bean public LocalContainerEntityManagerFactoryBean entityManagerFactory(DataSource dataSource) { LocalContainerEntityManagerFactoryBean entityManagerFactoryBean = new LocalContainerEntityManagerFactoryBean(); entityManagerFactoryBean.setDataSource(dataSource); entityManagerFactoryBean.setPackagesToScan(""); entityManagerFactoryBean.setJpaProperties(properties()); entityManagerFactoryBean.setJpaVendorAdapter(new HibernateJpaVendorAdapter()); return entityManagerFactoryBean; } private Properties properties() { Properties properties = new Properties(); properties.put("hibernate.show_sql", "true"); properties.put("hibernate.format_sql", "true"); return properties; } UPDATE
I had a similar config class as yours, since I am update to spring boot I removed that class and moved all the config to the application.properties file. My config is:
#DataSource spring.datasource.driver-class-name=org.postgresql.Driver spring.datasource.url=jdbc:postgresql://localhost:5432/mydb spring.datasource.username=postgres spring.datasource.password=123456 #Hibernate spring.jpa.properties.hibernate.show_sql=true spring.jpa.properties.hibernate.format_sql=true spring.jpa.properties.hibernate.jdbc.batch_size=10 spring.jpa.properties.hibernate.id.new_generator_mappings=true spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PostgreSQLDialect spring.jpa.properties.hibernate.current_session_context_class=org.springframework.orm.hibernate5.SpringSessionContext