Boa tarde, seguindo a dúvida da CRISTIANE STEFANIE SOUZA DE SANTANA, onde consegui resolver o mesmo tipo de problema. https://cursos.alura.com.br/forum/topico-erro-na-conexao-com-o-banco-postgresql-28220
Agora não aparece erro nenhum porém ao inicializar o servidor as tabelas do banco não estão sendo criadas. No console do eclipse existe apenas uma mensagem de WARNING
WARNING: [SetPropertiesRule]{Server/Service/Engine/Host/Context} Setting property 'source' to 'org.eclipse.jst.jee.server:srun' did not find a matching property.
Experimentei mudar a linha
props.setProperty("hibernate.hbm2dll.auto", "create");
mas nao funcionou.
JPAConfiguration
import java.util.Properties;
import javax.persistence.EntityManagerFactory;
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;
@EnableTransactionManagement
public class JPAConfiguration {
@Bean
public LocalContainerEntityManagerFactoryBean entityManagerFactory(){
LocalContainerEntityManagerFactoryBean factoryBean = new LocalContainerEntityManagerFactoryBean();
JpaVendorAdapter vendorAdapter = new HibernateJpaVendorAdapter();
factoryBean.setJpaVendorAdapter(vendorAdapter);
DriverManagerDataSource dataSource = new DriverManagerDataSource();
dataSource.setUsername("postgres");
dataSource.setPassword("postgres");
dataSource.setUrl("jdbc:postgresql://localhost:5432/meuBD");
dataSource.setDriverClassName("org.postgresql.Driver");
factoryBean.setDataSource(dataSource);
Properties props = new Properties();
props.setProperty("hibernate.dialect", "org.hibernate.dialect.PostgreSQLDialect");
props.setProperty("hibernate.show_sql", "true");
props.setProperty("hibernate.hbm2dll.auto", "update");
factoryBean.setJpaProperties(props);
factoryBean.setPackagesToScan("br.com.srun.models");
return factoryBean;
}
@Bean
public JpaTransactionManager transactionManager(EntityManagerFactory emf){
return new JpaTransactionManager(emf);
}
}
Agradeceria muito se os senhores pudessem me ajudar.
Grato, Aguardo.