How to map a composite identifier using an automatically @GeneratedValue with JPA and Hibernate

Introduction One of my readers asked me to answer the following StackOverflow question. While I already covered the best way to map composite identifiers with JPA and Hibernate, this use case is different because one column is automatically generated.

The best way to map a Composite Primary Key with JPA and Hibernate

Introduction One of my readers asked me to help him map a Composite Primary Key using JPA and Hibernate. Because this is a recurrent question, I decided to write a blog post in which I describe this mapping is more detail.

Hypersistence Optimizer can automatically detect if you are using JPA and Hibernate properly