Reputation: 2040
Is it possible in Spring Hibernate (connected to a MySQL database) to use an auto id generator without a dedicated sequence table like
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
@Column(name = "id")
private Long id;
but specify an initial Value for id?
Upvotes: 1
Views: 3199
Reputation: 23792
From the hibernate docs:
AUTO: selects IDENTITY, SEQUENCE or TABLE depending upon the capabilities of the underlying database.
So the initial value is the default initial value of the chosen generator. For example in case of the IDENTITY
generator, it is the auto_increment_value
of the primary key column of the table.
Upvotes: 2