Sachithra Pathiraja
Sachithra Pathiraja

Reputation: 149

JPA sequence generator says increment size differs from the value in DB

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

Sequence used

I have above entity class and oracle sequence. But I am getting following error.

Caused by: org.hibernate.MappingException: The increment size of the [CACHING_SEQUENCE] sequence is set to [50] in the entity mapping while the associated database sequence increment size is 1.

Upvotes: 1

Views: 4907

Answers (1)

Adata
Adata

Reputation: 84

You can use allocationSize = 1 for the sequence

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

here the samish issue: org.hibernate.MappingException: The increment size of the sequence is set to [10] in the entity mapping while ... size is [1]

Upvotes: 3

Related Questions