The StaleStateException should be thrown whenever you try to update a stale record and lose updates, which is
the whole point of using optimistic locking.
Related to update statement without the version column, I suspect that you are using bulk updates in which case you can use
the VERSIONED keyword.
The reason why Hibernate tries to select the version property with a separate query is because you used: generated="always". The use of "always" tells Hibernate that the database changes the version property on every insert and update. Usually, Hibernate manages this property so I don't see why do you have the generated="always" attribute at all. Try removing it and rely on Hibernate for managing the version column.