JPQL: What kind of objects contains a result list when querying multiple columns?

Posted by Bunkerbewohner on Stack Overflow See other posts from Stack Overflow or by Bunkerbewohner
Published on 2010-05-29T21:41:46Z Indexed on 2010/05/29 21:52 UTC
Read the original article Hit count: 219

Filed under:
|

Hello!

I'm trying to do something which is easy as pie in PHP & Co: SELECT COUNT(x) as numItems, AVG(y) as average, ... FROM Z

In PHP I would get a simple array like [{ numItems: 0, average: 0 }] which I could use like this:

echo "Number of Items: " . $result[0]['numItems'];

Usually in JPQL you only query single objects or single columns and get Lists types, for example List or List. But what do you get, when querying multiple columns?

© Stack Overflow or respective owner

Related posts about java

Related posts about jpql