We're updating the issue view to help you get more done. 

Enhancer dirty tracking doesn't work with inherited entities

Description

Given these two classes:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 @Entity private static abstract class Person { @Id private String name; @Version private long oca; public Person(String name) { this(); this.name = name; } protected Person() {} protected void setOca(long l) { this.oca = l; } } @Entity private static class Employee extends Person { private String title; public Employee(String name, String title) { super(name); this.title = title; } public Employee() {} public void setTitle(String title) { this.title = title; } }

Then this code:

1 2 Employee charles = new Employee( "Charles", "Engineer" ); charles.setOca( 1002 );

One would expect the "title" and "oca" fields to be dirty. However, Hibernate says only the "oca" field is dirty.

It appears the enhancer's dirty checker doesn't correctly handle inherited fields.

Here's a pull request which includes a test case demonstrating the issue: https://github.com/hibernate/hibernate-orm/pull/1654

Environment

None

Status

Assignee

Luis Barreiro

Reporter

Craig Andrews

Components

Fix versions

Affects versions

5.2.5

Priority

Major