Minha JPAConfiguration:
public class JPAConfiguration {
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(vendorAdapter);
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("root");
dataSource.setPassword("");
dataSource.setUrl("jdbc:mysql://localhost:3306/casadocodigo");
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
factoryBean.setDataSource(dataSource);
Properties properties = new Properties();
properties.setProperty("hybernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
properties.setProperty("hybernate.show_sql", "true");
properties.setProperty("hibernate.hbm2ddl.auto", "update");
factoryBean.setJpaProperties(properties);
factoryBean.setPackagesToScan("org.curso.loja.models");
return factoryBean;
}
}
Alguém me dá uma luz?