Bytecode-enhanced inline dirty tracking ignores generic associations from mapped superclasses

Description

Hibernate ORM’s bytecode-enhanced inline dirty tracking will ignore changes to Item.other in the following model. The problem seems related to generics since removing generics will fix it.

@Entity public static class Other { @Id @GeneratedValue private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } } @MappedSuperclass public static abstract class Item<T> { @ManyToOne( fetch = FetchType.LAZY ) private T other; public T getOther() { return other; } public void setOther(T other) { this.other = other; } } @Entity public static class ChildItem extends Item<Other> { @Id @GeneratedValue private Long id; public Long getId() { return id; } public void setId(Long id) { this.id = id; } }

Activity

Show:

Yoann Rodière April 12, 2023 at 10:20 AM

I don’t quite know what is wrong, but it seems bytecode enhancement does forget to track some changes. I created a reproducer here: https://github.com/hibernate/hibernate-orm/pull/6398

Fixed

Details

Assignee

Reporter

Fix versions

Affects versions

Priority

Created April 12, 2023 at 9:47 AM
Updated April 14, 2023 at 8:21 AM
Resolved April 14, 2023 at 6:53 AM