开发者

How do I access multiple fields in a JPA query?

I have a JPA query of the form:

SELECT category, count(*) AS c FROM ...

I know that if the query just returns a single column I can do something like:

List<Article> articles = query.getResultList开发者_开发知识库();

However, how do I access the results when there are 2 or more columns as in the example above?


check out section 14.6 here: http://docs.jboss.org/hibernate/core/3.3/reference/en/html/queryhql.html#queryhql-select

it will return a List of Object[] if you select more than one column, but dont get the actual entity.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜