【问题标题】:JPA sequence generator says increment size differs from the value in DBJPA 序列生成器说增量大小与 DB 中的值不同
【发布时间】:2020-10-14 20:20:21
【问题描述】:
@Table(name = "CACHING_DATA")
@Entity
public class CachingData implements Serializable {
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "CACHING_SEQUENCE")
    private Long id;
    private String protocolecode;
    private String uuid;
}

我有上面的实体类和oracle序列。但我收到以下错误。

原因:org.hibernate.MappingException:实体映射中[CACHING_SEQUENCE]序列的增量大小设置为[50],而关联的数据库序列增量大小为1

【问题讨论】:

  • 删除并重新创建数据库,可能会有帮助

标签: java oracle spring-boot hibernate jpa


【解决方案1】:

序列可以使用 allocationSize = 1

@SequenceGenerator(name = "SomeNameForTheGenerator", sequenceName = "CACHING_SEQUENCE", allocationSize = 1)

这里是 samish 问题:org.hibernate.MappingException: The increment size of the sequence is set to [10] in the entity mapping while ... size is [1]

【讨论】:

    猜你喜欢
    • 2011-09-25
    • 2013-03-02
    • 1970-01-01
    • 2012-12-19
    • 1970-01-01
    • 2014-05-12
    • 1970-01-01
    • 2017-09-21
    • 1970-01-01
    相关资源
    最近更新 更多