Home > OS >  Entity not creating table in DB
Entity not creating table in DB

Time:01-03

I'm using Spring boot, and I Run this model.

package com.example.demo.Models;

import jakarta.persistence.*;

@Entity
@Table(name = "user")
public class UserModel {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(unique = true, nullable = true)
    private Long id;
    private String name;
    private String email;
    private Integer priority;
   
    /* Here are all the setters and getters*/
}

application.properties:

spring.datasource.url=jdbc:postgresql://localhost:5432/dbdemo
spring.datasource.username=postgres
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=update

Everything fine with Java.

Process finished with exit code 0

But in the console of my docker image of Postgres I get the following error:

ERROR:  syntax error at or near "user" at character 14
STATEMENT: create table user(id bigserial not null, email varchar(255), name varchar(255), priority integer, primary key (id))

I'm not sure how to solve it, I'd appreciate any help, and happy new year

  • Related