This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
I just want to count the number of articles that belong to a category. Simple with a native query:
But a native query feels like an impurity. No IDE checks, no refactoring support, no startup checks by the persistence provider... I would prefer something in JPQL but I can't see how to access the "entity-less" relationship table.
Alternatively I could build an object for the relationship. Seems plausible, as I do work with it's elements.
Are those the ways to go or am I missing something important?