Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/spring-mvc/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java JpaSystemException:无法读取hi值-您需要填充表:_Java_Spring Mvc_Spring Data - Fatal编程技术网

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

Java JpaSystemException:无法读取hi值-您需要填充表:,java,spring-mvc,spring-data,Java,Spring Mvc,Spring Data,我有web jpa项目,我的项目来自postgres和mysql数据库,但当我在mysql数据库中添加新数据时,我得到异常: 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_sequ

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

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
这是我的实体类: 用户

@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;
}
UserKey

@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;
}

问题解决了,需要添加
insert到mysqldb中。hibernate_序列(next_val)值(0)
我将推荐
insert到hibernate_序列(next_val)值(1)插入0似乎会导致我出现意外行为。我不知道为什么会发生这种情况,但value
0
会导致第一次
repo.save()
触发两次。
@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;
}