when you use spring & Hibernate, have you ever met a log warning that says
WARN o.hibernate.ejb.HibernatePersistence - HHH015016: Encountered a
If you are working with Spring Data JPA and Java Configuration, you will be able to solve it, adding the following code in your Entity Manager Factory:
factory.setPersistenceProvider(new HibernatePersistenceProvider());
@Bean
public EntityManagerFactory entityManagerFactory() throws SQLException {
HibernateJpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
vendorAdapter.setGenerateDdl(true);
vendorAdapter.setShowSql(true);
LocalContainerEntityManagerFactoryBean factory = new LocalContainerEntityManagerFactoryBean();
factory.setJpaVendorAdapter(vendorAdapter);
**factory.setPersistenceProvider(new HibernatePersistenceProvider());**
factory.setPackagesToScan("com.company.appname.persistence.domain");
factory.setDataSource(dataSource());
factory.setJpaProperties(hibernateProperties());
factory.afterPropertiesSet();
return factory.getObject();
}
You will find a good example of Hibernate configuration with Spring Data JPA here: http://spring.io/guides/tutorials/data/3/