Spring 引导 "oracle.jdbc.OracleDatabaseException: ORA-00904: invalid identifier" 创建时出错 table
Spring boot "oracle.jdbc.OracleDatabaseException: ORA-00904: invalid identifier" Error while creating table
在 spring 引导中,我使用代码优先方法创建数据库表。
然后在 运行 应用程序时,其中一个表的结果显示此错误:
WARN o.h.t.s.i.ExceptionHandlerLoggedImpl.handleException - GenerationTarget encountered exception accepting command : Error executing DDL "alter table statistic add date timestamp" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceExcepti
on: Error executing DDL "alter table statistic add date timestamp" via JDBC Statement]
oracle.jdbc.OracleDatabaseException: ORA-00904: : invalid identifier
class实体如下:
@Entity
@Table(name = "statistic")
public class Statistic {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private Long value;
private Date date;
private String unit;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getValue() {
return value;
}
public void setValue(Long value) {
this.value = value;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}
有谁知道问题出在哪里?
这是错误的:
alter table statistic add date timestamp
----
this
date
是 Oracle 数据类型 的保留字。将列名称更改为其他名称,例如datum
、c_date
、statistic_date
、...然后是 运行
alter table statistic add datum timestamp
在 spring 引导中,我使用代码优先方法创建数据库表。 然后在 运行 应用程序时,其中一个表的结果显示此错误:
WARN o.h.t.s.i.ExceptionHandlerLoggedImpl.handleException - GenerationTarget encountered exception accepting command : Error executing DDL "alter table statistic add date timestamp" via JDBC Statement
org.hibernate.tool.schema.spi.CommandAcceptanceExcepti
on: Error executing DDL "alter table statistic add date timestamp" via JDBC Statement]
oracle.jdbc.OracleDatabaseException: ORA-00904: : invalid identifier
class实体如下:
@Entity
@Table(name = "statistic")
public class Statistic {
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
private Long id;
private String title;
private Long value;
private Date date;
private String unit;
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public Long getValue() {
return value;
}
public void setValue(Long value) {
this.value = value;
}
public Date getDate() {
return date;
}
public void setDate(Date date) {
this.date = date;
}
public String getUnit() {
return unit;
}
public void setUnit(String unit) {
this.unit = unit;
}
}
有谁知道问题出在哪里?
这是错误的:
alter table statistic add date timestamp
----
this
date
是 Oracle 数据类型 的保留字。将列名称更改为其他名称,例如datum
、c_date
、statistic_date
、...然后是 运行
alter table statistic add datum timestamp