Issue using enableDirtyTracking of hibernate-enhance-maven-plugin

I am upgrading to hibernate 6.6.53_Final from 5.5 and using the hibernate-enhance-maven-plugin with enableDirtyTracking true.

Version is mapped like:
@Version
@Column(name = "VERSION")
public Long getVersion() {
return version;
}

The enhanced code also seems to track the version:
public void setVersion(Long version) {
if (isChanged(this.$$_hibernate_read_version(), version)) {
this.$$_hibernate_write_version(version);
}
}

Creating a new hibernate object generates an INSERT statement followed by an UPDATE of the version.

Setting enableDirtyTracking to false however only generates an INSERT statement.

Is this expected behaviour?

I tested with hibernate 7.4.4.Final and the same behaviour is seen, an extra UPDATE for the version if enableDirtyTracking is true.

Please try to create a reproducer with our test case template and if you are able to reproduce the issue, create a bug ticket in our issue tracker and attach that reproducer.

Hi Christian,

I have a reproduce ORMStandaloneTestCase ready.

I tried creating a branch so that I could create a PR for it but I don’t seem to have the necessary rights to do so.

Thank you,

Kind regards,

Ivo

I will use my personal account and fork.

Ok, forked and created a PR, waiting for any reaction whether this is expected behavior or not.

For reference: dirty-check-behavior: by bambouzel · Pull Request #732 · hibernate/hibernate-test-case-templates · GitHub

Hi Christian,
Any idea when that PR will be looked at to check what would cause this behaviour?
Thank you,
Kind regards,
Ivo

Hi Ivo,

as with any open source project, it is at the discretion of the individuals that contribute to decide what they want to look at. I can’t speak about the priorities of others, but I personally don’t plan to work on this anytime soon and until you create a Jira ticket for it, nobody else from the community will know about this problem. So please, follow the process by creating a ticket, cross reference this discussion and attach/link the reproducer.

Cross reference Jira