Jack
Jack

Reputation: 1

Spring Boot cannot generate table in a PostgreSql database

I have a Spring Boot app and I created a PostgreSql database in a Docker container. I can connect to that database using tools, but when I run my Spring Boot app, it cannot create table even if the following log is seen on debug screen:

Hibernate: drop table if exists public.employees cascade
Hibernate: create table public.employees (id bigserial not null, email varchar(255), first_name varchar(255), last_name varchar(255), primary key (id))

Here is my properties file (I use PostgreSql 9+, database name is employee_management_system):

spring.datasource.url=jdbc:postgresql://localhost:5434/employee_management_system
spring.datasource.username=postgres
spring.datasource.password=******

spring.jpa.properties.hibernate.dialect = org.hibernate.dialect.PostgreSQL92Dialect
spring.jpa.properties.hibernate.default_schema = public
spring.jpa.hibernate.ddl-auto = create
spring.jpa.show-sql = true

I do not use a DOckerfile or docker-compose.yml (I think I do not need for this step as I already have a container for my PostgreSql database). Any idea?

Upvotes: 1

Views: 947

Answers (1)

sixrandanes
sixrandanes

Reputation: 4527

Seem like your spring-boot application have access to your database. Otherwise, you won't have the logs you put and you would have an exception when you start your application.

Maybe you have to check the way your are connected to your database (identifiers, schema, etc ..)?

Upvotes: 0

Related Questions