Query service ejb test

Hi Gunter.  This is the fix for the broken unit-tests that you mentioned last week. You might notice that I refactored some of the code in QueryServiceEJB to

A) make unit-testing easier by
B) reducing duplication and 
C) breaking the logic into smaller less-complex methods.

While writing the tests, I noticed some questionable logic.  I wrote a note to you on that, and I'll point out the code here.