Estou usando mysql 8 portanto tive q mexer algumas configurações do meu pom.xml, talvez esteja faltando alguma coisa. Segue o pom e o JPAConfiguration.java. OBS: não há nenhum erro logado no log do servidor
package br.com.casadocodigo.loja.conf;
import org.springframework.context.annotation.Bean;
import org.springframework.jdbc.datasource.DriverManagerDataSource;
import org.springframework.orm.jpa.JpaTransactionManager;
import org.springframework.orm.jpa.JpaVendorAdapter;
import org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean;
import org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import javax.persistence.EntityManagerFactory;
import java.util.Properties;
@EnableTransactionManagement
public class JPAConfiguration {
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(){
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(vendorAdapter);
DriverManagerDataSource driverManagerDataSource = new DriverManagerDataSource();
driverManagerDataSource.setUsername("root");
driverManagerDataSource.setPassword("root");
driverManagerDataSource.setUrl("jdbc:mysql://localhost:3306/casadocodigo?useSSL=false&serverTimezone=UTC");
driverManagerDataSource.setDriverClassName("com.mysql.cj.jdbc.Driver");
factoryBean.setDataSource(driverManagerDataSource);
Properties properties = new Properties();
properties.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5Dialect");
properties.setProperty("hibernate.show_sql", "true");
properties.setProperty("hibernate.hbm2dll.auto", "update");
factoryBean.setJpaProperties(properties);
factoryBean.setPackagesToScan("br.com.casadocodigo.loja.models");
return factoryBean;
}
@Bean
public JpaTransactionManager transactionManager(EntityManagerFactory emf){
return new JpaTransactionManager(emf);
}
}