Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hibernate: Could not obtain connection to query metadata

I'm following Amigoscode tutorial Getting Started with Spring Boot and I'm currently trying to connect to my local database, but I get an error:

HHH000342: Could not obtain connection to query metadata

What I've learned is that Hibernate recent version works different, so the tutorial content it out of data. So I was wondering, can use a older version of Hibernate?

I can also be totally wrong about Hibernate. If this is a command error plz give me some information.


spring.datasource.url=jdbc:postgresql://localhost:5432/student
spring.datasource.username=postgres
spring.datasource.password=******
spring.jpa.hibernate.ddl-auto=create-drop
spring.java.show-sql=true   
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PosterSQLDialect
spring.jpa.properties.hibernate.format_sql=true

NEW ERROR

49.203 ERROR 9572 --- [           main] j.LocalContainerEntityManagerFactoryBean : Failed to initialize JPA EntityManagerFactory: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
2022-04-06 11:39:49.203  WARN 9572 --- [           main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
like image 596
Flying Nimbus Avatar asked Oct 23 '25 10:10

Flying Nimbus


1 Answers

There is no meaning of PosterSQLDialect in configuration of hibernate dialect. It should be PostgreSQLDialect.

Change

spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.PosterSQLDialect

To

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQLDialect
like image 170
Faheem azaz Bhanej Avatar answered Oct 25 '25 13:10

Faheem azaz Bhanej



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!