diff --git a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java index 2b92b74dab..fe3dfb05c4 100644 --- a/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java +++ b/hibernate-core/src/main/java/org/hibernate/query/sqm/sql/BaseSqmToSqlAstConverter.java @@ -913,7 +913,21 @@ public abstract class BaseSqmToSqlAstConverter extends Base value = new BinaryArithmeticExpression( versionColumn, ADD, - new QueryLiteral<>( 1, versionType ), + new QueryLiteral<>( + persister.getVersionJavaType().next( + persister.getVersionJavaType().seed( + versionMapping.getLength(), + versionMapping.getPrecision(), + versionMapping.getScale(), + null + ), + versionMapping.getLength(), + versionMapping.getPrecision(), + versionMapping.getScale(), + null + ), + versionType + ), versionType ); }