JPA Query.getResultList() - use in a generic way

The Solution to JPA Query.getResultList() - use in a generic way is


General rule is the following:

  • If select contains single expression and it's an entity, then result is that entity
  • If select contains single expression and it's a primitive, then result is that primitive
  • If select contains multiple expressions, then result is Object[] containing the corresponding primitives/entities

So, in your case list is a List<Object[]>.

~ Answered on 2012-12-04 10:37:55


Most Viewed Questions: