I have several entities using AUTO
key generation strategy with Hibernate
and postgres
.
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
private Long id;
This will result in a hibernate_sequence
generated, and each entity will make use of that sequence when assigning keys.
Now I have a table that has lots of cache data (like 100k entries), and some user tables. As both use strategy AUTO
, they both get their keys from the same hibernate sequence. As a result, even if I only have 10 users, they will all have an id of 6-7 digits long, like 123123
.
I wonder if, in general, one should introduce a custom sequence for each table? Or shouldn't I care about the id generation that much?