Well, what addScalar is doing is telling Hibernate that the native query has an “additional” scalar result, of the type you specify. Are you saying that in 5 this was not the case? Maybe a reproducer test case for this would give us insight into the problem. In any case, since you should always indicate the result class in createNativeQuery (the method without type information has been deprecated since 6.0) I think the behavior is correct, and the addScalar call should simply be avoided. |