JpaSystemException:无法读取hi值 - 您需要填充表:

Boh*_*ich 5 java spring-mvc spring-data

我有web-jpa项目,我的项目工作来自postgres和mysql数据库,但是当我在mysql db中添加新数据时,我得到异常:

HTTP Status 500 - Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not read a hi value - you need to populate the table: hibernate_sequence; nested exception is org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_sequence

ERROR [http-nio-8080-exec-5] <unknown>.<unknown> could not read a hi value - you need to populate the table: hibernate_sequence
Run Code Online (Sandbox Code Playgroud)

堆栈跟踪

org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.springframework.orm.jpa.JpaSystemException: could not read a hi value - you need to populate the table: hibernate_sequence; nested exception is org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_sequence
    ...
root cause

org.springframework.orm.jpa.JpaSystemException: could not read a hi value - you need to populate the table: hibernate_sequence; nested exception is org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_sequence
    ...
root cause

org.hibernate.id.IdentifierGenerationException: could not read a hi value - you need to populate the table: hibernate_sequence
    ...
Run Code Online (Sandbox Code Playgroud)

这是我的实体类: 用户

@Entity
@Table(name = "USERS_TABLE")
public class User {
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long id;
    @Column(name = "USERS_NAME")
    private String name;
    @Column(name = "USERS_EMAIL")
    private String email;
}
Run Code Online (Sandbox Code Playgroud)

用户密钥

@Entity
@Table(name = "USERS_KEY")
public class UserKey {
    @Id
    @GeneratedValue
    private Long id;
    @Column(name = "KEY_COLUMN")
    private int key;
    @OneToOne
    @JoinColumn(name = "USERS_ID")
    private User user;
}
Run Code Online (Sandbox Code Playgroud)