Hi!
we recently switched to Hibernate 5.4.32 from 5.4.25 final. The following code started failing with the following exception trace
at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1423)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.hibernate.MappingException: Unknown SqlResultSetMapping [GetRoutePackageResponseMapper]
at org.hibernate.query.internal.NativeQueryImpl.setResultSetMapping(NativeQueryImpl.java:150)
at org.hibernate.internal.AbstractSharedSessionContract.createNativeQuery(AbstractSharedSessionContract.java:1044)
... 152 more
Code to retrieve Result from a stored procedure
private OrderResponse getOrder(String orderId) {
return (OrderResponse) entityManager
.createNativeQuery("select * from pkg_order.getOrder(?)", "OrderResponseMapper")
.setParameter(1, orderId)
.getSingleResult();
}
@SqlResultSetMapping(
name = "OrderResponseMapper",
classes = @ConstructorResult(
targetClass = OrderResponse.class,
columns = {
@ColumnResult(name = "ORDERID", type = String.class),
@ColumnResult(name = "DATE", type = String.class),
@ColumnResult(name = "STATUS", type = String.class)
}
)
)
@AllArgsConstructor
@Data
public class OrderResponse {
private String orderId;
private String date;
private String status;
}
The same code works with 5.4.25 final. We did not make any other change.
This map namedSqlResultSetMappingMap in empty in NamedQueryRepository after the upgrade