How to implement a custom String-based sequence identifier generator with Hibernate
Introduction One of my blog readers bumped into the assigned generator with a sequence or an identity column post and wondered if it was possible to generate String-based identifiers instead. I accepted the challenge and answered his question on StackOverflow. However, this post is going to explain this topic in greater detail, so there we go.
How to combine the Hibernate assigned generator with a sequence or an identity column
Introduction The entity identifier can either be manually assigned, or it can be automatically generated by an identity column or a database sequence. In this post, I’ll show you how you can mix the assigned generator with an identity column or a database sequence.
Hibernate and UUID identifiers
Introduction In this article, we are going to see how the UUID entity attributes are persisted when using JPA and Hibernate, for both assigned and auto-generated identifiers. In my previous post I talked about UUID surrogate keys and the use cases when there are more appropriate than the more common auto-incrementing identifiers. A UUID database type There are several ways to represent a 128-bit UUID, and whenever in doubt I like to resort to Stack Exchange for an expert advice. Because table identifiers are usually indexed, the more compact the database type… Read More