Started work on supporting count() aggregates, and refactoring the JPA
code a bit now that I'm more comfortable with how the code will evolve.