我想用 query.setResultTransformer(Transformers.ALIAS_TO_ENTITY_MAP)
获取 List<Map>
.但我有一个异常(exception):
java.lang.NoSuchMethodError: org.hibernate.query.Query.setResultTransformer(Lorg/hibernate/transform/ResultTransformer;)Lorg/hibernate/Query;
我找不到 org.hibernate.query.Query
的实现类.
方法setResultTransformer
在 org.hibernate.Query
.
为什么不推荐使用 org.hibernate.Query?
最佳答案
The ResultTransformer comes with a legacy definition which is not following the Functional Interface syntax. Hence, we cannot use a lambda in this example. Hibernate 6.0 aims to overcome this issue, so that’s why the Hibernate ORM 5.2 ResultTransformer is deprecated. Nevertheless, an alternative will be provided, so the concept we are discussing in this article is going to stand still even in Hibernate 6.
关于java - Hibernate 5.2后如何使用 `setResultTransformer`?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38240015/