# Generic ID in @MappedSuperclass resolved as upper bound (Serializable) instead of concrete type in subclass

**URL:** <https://discourse.hibernate.org/t/generic-id-in-mappedsuperclass-resolved-as-upper-bound-serializable-instead-of-concrete-type-in-subclass/12337>\
**Category:** Hibernate ORM\
**Created:** [June 10, 2026, 10:52am UTC](https://discourse.hibernate.org/t/generic-id-in-mappedsuperclass-resolved-as-upper-bound-serializable-instead-of-concrete-type-in-subclass/12337 "2026-06-10T10:52:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gopal\_Bhogar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/gopal_bhogar/32/4191_2.png) [@Gopal\_Bhogar](https://discourse.hibernate.org/u/Gopal_Bhogar)\
**Post date:** [June 10, 2026, 10:52am UTC](https://discourse.hibernate.org/t/generic-id-in-mappedsuperclass-resolved-as-upper-bound-serializable-instead-of-concrete-type-in-subclass/12337/1 "2026-06-10T10:52:19Z")

</div>

When using a generic identifier in a `@MappedSuperclass` (e.g. via Spring Data’s `AbstractPersistable<PK extends Serializable>`), Hibernate 7.x does not consistently resolve the concrete type parameter provided by subclasses.

Instead, during model building, the identifier type is treated as the generic upper bound: `java.io.Serializable `rather than the actual concrete type bound in the subclass (e.g. `Long`, `UUID`).

⚠ Impact

This results in a **behavioral change compared to previous Hibernate versions** , specifically affecting **identifier generator resolution**.

✅ Before Hibernate 7.x

In earlier versions (e.g. Hibernate 5.x / early 6.x), generator selection was straightforward and effectively used the resolved concrete type.

Example reference:

- Generation strategy interpreter logic  
[hibernate-orm/hibernate-core/src/main/java/org/hibernate/boot/internal/GenerationStrategyInterpreter.java at 29333239d333e4b6ae730356fd412e0f4900309a · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/blob/29333239d333e4b6ae730356fd412e0f4900309a/hibernate-core/src/main/java/org/hibernate/boot/internal/GenerationStrategyInterpreter.java#L63)

👉 Behavior:

- If subclass specifies:

- Hibernate correctly resolves ID type as `UUID`

- Appropriate generator (e.g. `UUIDGenerator`) is selected

❌ After Hibernate 7.x

In Hibernate 7.x, generator resolution happens through:

- `IdGeneratorResolverSecondPass`

Reference:

- [hibernate-orm/hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdGeneratorResolverSecondPass.java at ecd25d85a13df1921ec8da1a6318eab3e882054c · hibernate/hibernate-orm · GitHub](https://github.com/hibernate/hibernate-orm/blob/ecd25d85a13df1921ec8da1a6318eab3e882054c/hibernate-core/src/main/java/org/hibernate/boot/model/internal/IdGeneratorResolverSecondPass.java#L221)

👉 Behavior:

- Identifier type is resolved as:

- Since the type is not recognized as a specific concrete type (e.g. `UUID`)

- Hibernate falls back to a default generator, typically:

---

<div class="post-metadata">

**Author:** ![beikov](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/beikov/32/258_2.png) [@beikov](https://discourse.hibernate.org/u/beikov)\
**Post date:** [June 11, 2026, 10:30am UTC](https://discourse.hibernate.org/t/generic-id-in-mappedsuperclass-resolved-as-upper-bound-serializable-instead-of-concrete-type-in-subclass/12337/2 "2026-06-11T10:30:00Z")

</div>

Please try to create a reproducer with our [test case template](https://github.com/hibernate/hibernate-test-case-templates/blob/master/orm/hibernate-orm-7/src/test/java/org/hibernate/bugs/JPAUnitTestCase.java) and if you are able to reproduce the issue, create a bug ticket in our [issue tracker](https://hibernate.atlassian.net) and attach that reproducer.

---

<div class="post-metadata">

**Author:** ![Gopal\_Bhogar](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.hibernate.org/gopal_bhogar/32/4191_2.png) [@Gopal\_Bhogar](https://discourse.hibernate.org/u/Gopal_Bhogar)\
**Post date:** [June 11, 2026, 11:08am UTC](https://discourse.hibernate.org/t/generic-id-in-mappedsuperclass-resolved-as-upper-bound-serializable-instead-of-concrete-type-in-subclass/12337/3 "2026-06-11T11:08:34Z")

</div>

Sure : [Jira](https://hibernate.atlassian.net/browse/HHH-20547)
