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;
}
}