我正在使用 Spring boot,并且运行这个模型。
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*/
}
应用程序属性:
spring.datasource.url=jdbc:postgresql://localhost:5432/dbdemo
spring.datasource.username=postgres
spring.datasource.password=password
spring.jpa.hibernate.ddl-auto=update
Java 一切都很好。
Process finished with exit code 0
但在 Postgres 的 docker 映像的控制台中,我收到以下错误:
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))
我不确定如何解决它,我将不胜感激任何帮助。
create table public.user ( id serial not null,
email varchar(255),
name varchar(255),
priority integer,
primary key (id))
在表名之前添加模式名称
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)