I'm running Hibernate 3.5.5 as persistence provider and I get these errors:
I was surprised that you can use TypedQueries for native queries (the 'getFreeIds' named query works perfectly).
Googling around I've found a few uses cases where the result set is mapped on pojos but there are not much detail.
The Pro JPA2 book by Mike Keith doesn't seemt to address the problem at all.
Thankful for any help here
E Erik Svensson
posted 5 years ago
I found it myself.
The class that maps the result set needs to be an Entity.
It also needs an id. My problem was then that the rows of the result set were not guaranteed to be unique so I had to add the row index to the result set.
Then it worked as desired.