We would like to reserve a set of primary key identifiers for all tables (e.g. 1-1000) so that we can bootstrap the system with pre-loaded system data.
All our JPA entity classes have the following definition for the primary key.
@Id
@GeneratedValue(strategy = IDENTITY)
@Column(name = "id", unique = true, nullable = false, insertable = false, updatable = false)
private Integer id;
is there a way to tell the database that increments should start happening from 1000 (i.e. customer specific data will start from 1000 onwards). We support (h2, mysql, postgres
) in our environment and I would prefer a solution which can be driven via JPA and reverse engineering DDL tools from Hibernate.
Let me know if this is the correct approach