especially for these cases Hibernate has the new SomethingClass available. You create a view class with the default constructor and a constructor which matches the vars you want to use.
The query must be changed to
SELECT new playerStat(pl.lastName, pl.firstName, ps.jerseyNbr, ps.isStarter, ps.pf, SUM(st.pts), (SUM(st.pts)-SUM(st.ftm)-SUM(st.tpm)*3)/2, SUM(st.tpm), SUM(st.ftm), SUM(st.fta)) from ...
Instead of an object array you will geta a list with the newly created PlayerStat objects. Your code is much cleaner and you save yourself some additional transfer work.
Thanks for your answer. I very much appreciate your extremely valuable tips.
BTW the syntax isn't specific to Hibernate, it's JPA-compatible.
I just found this in my JPA book:
Constructor expressions are powerful tools for constructing coarse-grained data transfer objects or view objects for use in other application tiers.
This is interesting! I didn't know fine-grained entity objects are considered model domain, whereas coarse-grained non-entity objects are considered rather view domain. That really changes my view on coarse-grained objects.