diff --git a/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java b/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java index 9b5489214e..cdf1272477 100644 --- a/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java +++ b/core/src/main/java/org/hibernate/hql/ast/HqlSqlWalker.java @@ -26,6 +26,7 @@ package org.hibernate.hql.ast; import java.io.Serializable; import java.util.ArrayList; +import java.util.Calendar; import java.util.Date; import java.util.HashMap; import java.util.HashSet; @@ -1116,7 +1117,7 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par eq.setFirstChild( versionPropertyNode ); AST versionIncrementNode = null; - if ( Date.class.isAssignableFrom( versionType.getReturnedClass() ) ) { + if ( isTimestampBasedVersion( versionType ) ) { versionIncrementNode = getASTFactory().create( HqlSqlTokenTypes.PARAM, "?" ); ParameterSpecification paramSpec = new VersionTypeSeedParameterSpecification( versionType ); ( ( ParameterNode ) versionIncrementNode ).setHqlParameterSpecification( paramSpec ); @@ -1141,6 +1142,12 @@ public class HqlSqlWalker extends HqlSqlBaseWalker implements ErrorReporter, Par } } + private boolean isTimestampBasedVersion(VersionType versionType) { + final Class javaType = versionType.getReturnedClass(); + return Date.class.isAssignableFrom( javaType ) + || Calendar.class.isAssignableFrom( javaType ); + } + private AST generateVersionPropertyNode(Queryable persister) throws SemanticException { String versionPropertyName = persister.getPropertyNames()[ persister.getVersionProperty() ]; AST versionPropertyRef = getASTFactory().create( HqlSqlTokenTypes.IDENT, versionPropertyName );