问题描述
有没有办法通过在实体管理器上执行 nativeQuery
来获取返回结果的 MetaData
JPA?
Is there a way to get the MetaData
of the result returned by executing a nativeQuery
on an Entity Manager in JPA?
推荐答案
AFAIK无法获取结果集元数据,因为没有办法获取结果集。但是,转过身来:你想要什么元数据?结果集元数据中的大部分信息都必须能够为实体类添加注释。
传统SQL / JDBC的结果集和从EntityManager获得的List在概念上有所不同,即使它们可以表达相同的语义。
AFAIK there is no way of getting the result set metadata since there is no way really, of getting the result set. But, turn it around: what do you want the meta data for? Most of the information from the result set metadata you already have to have to be able to annotate your entity classes.The result set from conventional SQL/JDBC and the List you get from the EntityManager differs conceptually even if they can express the same semantics.
这篇关于如何从实体管理器获取ResultSetMetaData?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!