序列"HIBERNATE_SEQUENCE"被指定为"HIBERNATE_SEQUENCE".未找到; SQL语句 [英] Sequence "HIBERNATE_SEQUENCE" not found; SQL statement

查看:94
本文介绍了序列"HIBERNATE_SEQUENCE"被指定为"HIBERNATE_SEQUENCE".未找到; SQL语句的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的spring mvc应用程序中,我有以下对象.我正在尝试在应用程序中使用devtool可视化数据.

In my spring mvc app, i have the following object. I am trying to make a visual of data using devtool in my app.

@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制作了实体:

Then i used the jpa to make the entity:

@Repository
public interface ConsultationRequestRepository extends JpaRepository<ConsultationRequest, Long> {

}

问题是当我加载应用程序时,我遇到2个错误:

The problem is when i load my application, i face with 2 errors:

 Unsuccessful: drop sequence hibernate_sequence
[36morg.hibernate.tool.hbm2ddl.SchemaExport  Sequence "HIBERNATE_SEQUENCE" not found; SQL statement:

然后,当我打开

http://localhost:8080/h2-console/

我看不到桌子. 看来在引导过程中,表是没有制成的.

I cannot see the table. It seems that the in the boot process, table is not made.

推荐答案

如下更新代码:

 @Id
 @GeneratedValue(strategy = GenerationType.IDENTITY)
 private Long id;

由于您尚未指定序列表名,因此hibernate将查找名为 hibernate_sequence 的序列表,并将其用作默认值.

As you have not specified a sequence table name, hibernate will look for a sequence table named as hibernate_sequence and use it as default.

对于Oracle/Postgres,使用的增量字段是序列表.
在MySql中,有自动递增的增量字段.

For Oracle/Postgres, increment fields used are sequence tables.
In MySql, there are increment fields that automatically increment.

这篇关于序列"HIBERNATE_SEQUENCE"被指定为"HIBERNATE_SEQUENCE".未找到; SQL语句的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆