I have a java spring boot project which needs to be run on both MySQL and Oracle databases. The project has multiple entities with primary keys set to auto-increment in the db.
I have identified that Hibernate's @GenericGenerator in native strategy will support both MySQL (as IDENTITY) and Oracle (as SEQUENCE) in terms of auto-increment depending on the type of db. But I can't seem to find how to set the allocationSize in the GenericGenerator, for an oracle sequence. I want the allocationSize to be set to 1.
@Id
@GeneratedValue(strategy = GenerationType.AUTO, generator="gen")
@GenericGenerator(name = "gen", strategy = "native")
@Column(name = "id", nullable = false)
private Long id;
//Getter and Setter