Skip to content

Commit 2d9e73d

Browse files
committed
fill in a method of NativeQuery which was introduced in 6.0 and never implemented
1 parent 126ae01 commit 2d9e73d

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

hibernate-core/src/main/java/org/hibernate/query/results/internal/Builders.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -185,14 +185,17 @@ public static ResultBuilder attributeResult(
185185
);
186186
}
187187

188-
public static ResultBuilder attributeResult(String columnAlias, SingularAttribute<?, ?> attribute) {
189-
if ( ! ( attribute.getDeclaringType() instanceof EntityType ) ) {
188+
public static ResultBuilder attributeResult(
189+
String columnAlias,
190+
SingularAttribute<?, ?> attribute,
191+
SessionFactoryImplementor sessionFactory) {
192+
if ( ! ( attribute.getDeclaringType() instanceof EntityType<?> entityType ) ) {
190193
throw new UnsupportedOperationException(
191194
"Support for defining a NativeQuery attribute result based on a composite path is not yet implemented"
192195
);
193196
}
194197

195-
throw new UnsupportedOperationException();
198+
return attributeResult( columnAlias, entityType.getName(), attribute.getName(), sessionFactory );
196199
}
197200

198201
/**

hibernate-core/src/main/java/org/hibernate/query/sql/internal/NativeQueryImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ public NativeQueryImplementor<R> addAttributeResult(
10901090
public NativeQueryImplementor<R> addAttributeResult(
10911091
String columnAlias,
10921092
@SuppressWarnings("rawtypes") SingularAttribute attribute) {
1093-
registerBuilder( Builders.attributeResult( columnAlias, attribute ) );
1093+
registerBuilder( Builders.attributeResult( columnAlias, attribute, getSessionFactory() ) );
10941094
return this;
10951095
}
10961096

0 commit comments

Comments
 (0)