在我的 spring mvc 应用程序中,我有以下对象。我正在尝试在我的应用程序中使用 devtool
来可视化数据。
@Entity
@Data
public class ConsultationRequest {
@Id
@GeneratedValue
private Long id;
private String name;
private String email;
private String purpose;
private String programme;
private int year;
private String language;
private String comments;
@Enumerated(EnumType.STRING)
private ConsultationStatus status;
}
然后我使用 jpa 来制作实体:
@Repository
public interface ConsultationRequestRepository extends JpaRepository<ConsultationRequest, Long> {
}
问题是当我加载我的应用程序时,我遇到了 2 个错误:
Unsuccessful: drop sequence hibernate_sequence
[36morg.hibernate.tool.hbm2ddl.SchemaExport Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:
然后当我打开
http://localhost:8080/h2-console/
我看不到桌子。好像是在boot过程中,表没有做出来。
原文由 Jeff 发布,翻译遵循 CC BY-SA 4.0 许可协议
更新您的代码如下:
由于您没有指定序列 表名称,hibernate 将查找名为 hibernate_sequence 的序列表并将其用作 默认值。
对于 Oracle/Postgres,使用的增量字段是序列表。
在MySql中,有自增的自增字段。