Correction to the QuerySqmImpl constructor used for criteria queries

Signed-off-by: Jan Schatteman <jschatte@redhat.com>
This commit is contained in:
Jan Schatteman 2021-04-15 22:54:49 +02:00 committed by Steve Ebersole
parent 4f6019d524
commit 9e66c77749
1 changed files with 2 additions and 5 deletions

View File

@ -199,17 +199,14 @@ public class QuerySqmImpl<R>
SharedSessionContractImplementor producer) {
super( producer );
if ( sqmStatement instanceof SqmSelectStatement ) {
if ( resultType != null ) {
SqmUtil.verifyIsSelectStatement( sqmStatement );
visitQueryReturnType(
( (SqmSelectStatement<R>) sqmStatement ).getQueryPart(),
resultType,
producer.getFactory()
);
}
else {
assert sqmStatement instanceof SqmDmlStatement;
throw new IllegalArgumentException( "Non-select queries cannot be typed" );
}
this.hqlString = CRITERIA_HQL_STRING;
this.sqmStatement = sqmStatement;