JPA and Hibernate identifiers

preview_player
Показать описание
In this video episode, I'm talking about JPA and Hibernate entity identifiers.

First, I discuss about database Primary Keys and why synthetic identifiers are usually preferred.

Afterwards, I go through all JPA identifier generators: IDENTITY, SEQUENCE, TABLE, and AUTO.
Рекомендации по теме
Комментарии
Автор

This video is a bit outdated. HIbernate 6 completely missing. The strategy value from GenericGenerator annotation became deprecated, and later whole GenericGenerator became deprecated, how to solve this?

infinity
Автор

well, you've kinda flattened the UUID identifier topic. There are many different kinds of UUIDs, including sequential ones like UUIDv7 and ULID. Both take up space (which really is a no-issue for most of us, we're not managing data warehouses and the disk space is cheap), but are fast and work well with clustered indexes. You also forgot to mention that autoincremented INT identifiers can be a potential security thread (depending on business context and implementation details) and lead to "Insecure Direct Object Reference" attacks.

eXsio