@UpdateTimestamp not working with @Inheritance( strategy = JOINED )

Description

We have

which is extended by an AbstractPerson type;

which is extended by a Customer type

when a field in the Customer type is updated (via a setter), there is no update of the "modifiedAt" time, and it will remain at the createdAt time. The only issued SQL statement for the update is;

Environment

None

Activity

Show:
NiclasH
July 12, 2017, 2:17 AM

Actually, removing the refresh() doesn't help. If I just call the setEmail method and then commit, I get the same result at SQL level, although the modifedAt field in the entity will be correct after the commit.

IMHO, it is inconsistent at best.

So, in this testcase, the entity is created and committed, then loaded, changed and committed, and finally loaded and checked.

UnitOfWork.complete() in terms of EntityManager, only calls EntityManager.commit()
The Queries uses JPA TypedQuery.

NiclasH
July 12, 2017, 4:47 AM

Here is a complete testcase, showing the problem as I see it.

Andrea Boriero
July 12, 2017, 10:26 AM

Hi ,

it seems that when a property not belonging to the Parent class is modified the createdAt property is not updated.

the updateParentClassProperty works but the updateSubClassProperty fails.

NiclasH
July 13, 2017, 4:24 AM

Yes, that is a reasonable conclusion, but since the field itself is updated, it is that the "update" manages to bypass the detection of change, and it is difficult for me to figure out where inside Hibernate start digging for that, and hope to have experts look into it.

FTR, I have circumvented this bug by adding the update in onFlushDirty() interceptor which works.

Andrea Boriero
July 13, 2017, 9:33 AM

Hi ,

thanks for the feedback, I'll look into it.

Assignee

Andrea Boriero

Reporter

NiclasH

Fix versions

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Affects versions

Priority

Major
Configure