Default Dirty Checking strategy misses an update on fields named with an '_' as second char

Description

The problem happens when:

  • The 'enableDirtyTracking' options is true and the entity is annotated on getters and the update field has a name with an '_' as a second character.

In the attachment there's a small program that illustrates the problem.

We have an entity (Garanz) with a db field N_RIS. The attribute name is nRis, the getter is getNRis(). If we update just NRis, the DefaultFlushEntityEventListener comes in play and its method dirtyCheck is called:

The problem is that hibernate_getDirtyAttributes() contains nRis, while persister.resolveAttributeIndexes matches it with an EntityMetaModel that has a NRis name (with a capitalized 'N').

Moving annotations from getters to fields is a valid workaorund. Unfortunately sometimes this is not easy to do due to reflection considerations that our application do with the entities.

Setting enableDirtyTracking is another option, and probably we'll choose this one at the moment.

Environment

Payara 5.183, Oracle 10, JDK 1.8.0.181, Windows 7
Hibernate: 5.2.14 / 5.3.7

Assignee

Unassigned

Reporter

SIA s.p.a

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

Priority

Minor
Configure