Ah but of course, I completely forgot that DML HQL was not versioned by default! Thanks
I suspect that to achieve the same thing with dirty checking, managed entities and updates on flush is not possible out of the box? Most certainly because it’s way too complex to control when flushes happen, etc?
I was thinking defining a Generator on the Version field and if a certain transient field was set on the entity, then version would not be incremented. But this seems hacky and very hard to reason about.
If your state transformation is not idempotent, you should really consider using optimistic locking, otherwise you might write data that doesn’t fit the assumptions based on the load statement before.