diff --git a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java index 60287e9aee..a7bf501d09 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -889,9 +889,10 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont } private void handleNativeQueryResult(NativeQueryImplementor query, Class resultClass) { - if (Tuple.class.equals(resultClass)) { - query.setResultTransformer(new NativeQueryTupleTransformer()); - } else { + if ( Tuple.class.equals( resultClass ) ) { + query.setResultTransformer( new NativeQueryTupleTransformer() ); + } + else { query.addEntity( "alias1", resultClass.getName(), LockMode.READ ); } } diff --git a/hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java b/hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java index 81b216a613..430f3cb891 100644 --- a/hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java +++ b/hibernate-core/src/main/java/org/hibernate/jpa/spi/NativeQueryTupleTransformer.java @@ -1,3 +1,9 @@ +/* + * Hibernate, Relational Persistence for Idiomatic Java + * + * License: GNU Lesser General Public License (LGPL), version 2.1 or later. + * See the lgpl.txt file in the root directory or . + */ package org.hibernate.jpa.spi; import java.util.ArrayList;