more standard conform exception handling in FlatQueryBuilder
use random UUID instead of a static int counter

The previous approach with a static int variable is not really thread-safe and we don't want to have potential side effects (like very large IDs or integer overflows) between the user sessions
make inner class static