Tive problemas ao tentar iniciar o projeto. Primeiro tem um erro que nao sai da pasta Java Resources, e o eclipse nao diz onde é... Segundo, creio que exista algum conflito com o metodo "getEntityManagerFactory"... Me ajuda ai pessoal :| ... Versao java: 11 Versao MySQL: 8.0.20 Erro ao subir o server:
[localhost-startStop-1] INFO org.springframework.web.context.ContextLoader - Root WebApplicationContext: initialization started
log4j:WARN No appenders could be found for logger (org.jboss.logging).
log4j:WARN Please initialize the log4j system properly.
Hibernate: alter table Produto drop foreign key FKbsrs2q7ixb8srg7d0nfys9s5e
[localhost-startStop-1] WARN org.springframework.web.context.support.AnnotationConfigWebApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getEntityManagerFactory' defined in class path resource [br/com/caelum/JpaConfigurator.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.SQLGrammarException: Unable to open JDBC Connection for DDL execution
[localhost-startStop-1] ERROR org.springframework.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getEntityManagerFactory' defined in class path resource [br/com/caelum/JpaConfigurator.class]: Invocation of init method failed; nested exception is javax.persistence.PersistenceException: [PersistenceUnit: default] Unable to build Hibernate SessionFactory; nested exception is org.hibernate.exception.SQLGrammarException: Unable to open JDBC Connection for DDL execution
Versoes dependencias do pom: log4j => 1.2.14; spring => 5.1.5; mysql => 8.0.20
Metodo da classe "JPACONFIGURATOR":
@Bean
public LocalContainerEntityManagerFactoryBean getEntityManagerFactory(DataSource dataSource) {
LocalContainerEntityManagerFactoryBean entityManagerFactory = new LocalContainerEntityManagerFactoryBean();
entityManagerFactory.setPackagesToScan("br.com.caelum");
entityManagerFactory.setDataSource(dataSource);
entityManagerFactory
.setJpaVendorAdapter(new HibernateJpaVendorAdapter());
Properties props = new Properties();
props.setProperty("hibernate.dialect", "org.hibernate.dialect.MySQL5InnoDBDialect");
props.setProperty("hibernate.show_sql", "true");
props.setProperty("hibernate.hbm2ddl.auto", "create-drop");
entityManagerFactory.setJpaProperties(props);
return entityManagerFactory;
}