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 265cd2c674..edf4df1724 100644 --- a/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java +++ b/hibernate-core/src/main/java/org/hibernate/internal/AbstractSharedSessionContract.java @@ -1065,14 +1065,7 @@ public abstract class AbstractSharedSessionContract implements SharedSessionCont private SelectionQuery createNamedNativeSelectionQuery( NamedNativeQueryMemento memento, Class expectedResultType) { - throw new UnsupportedOperationException( - String.format( - Locale.ROOT, - "Support for `@%s` + `%s` is not (yet) implemented", - NamedNativeQuery.class.getName(), - SelectionQuery.class.getName() - ) - ); + return memento.toQuery( this, expectedResultType ); } private SqmSelectionQuery createNamedSqmSelectionQuery( diff --git a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java index 700803d455..b64648caa0 100644 --- a/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java +++ b/hibernate-core/src/test/java/org/hibernate/orm/test/jpa/query/NamedNativeQueryWithResultMappingTest.java @@ -17,7 +17,6 @@ import org.junit.jupiter.api.Test; @SessionFactory @DomainModel(annotatedClasses = NamedNativeQueryWithResultMappingTest.Mapped.class) -@FailureExpected( jiraKey = "HHH-18537", reason = "Call to #createNamedSelectionQuery for native-query, which never worked." ) @Jira( "https://hibernate.atlassian.net/browse/HHH-18537" ) public class NamedNativeQueryWithResultMappingTest { @Test void test(SessionFactoryScope scope) {