WL-3067 Correctly handle both Long and Integer.

H2 returns Long and MySQL returns Integer when counting rows. Now we cope with both cases. We can also use the standard uniqueResult() as it does the same (throwing exception) when multiple rows are returned.
Merge pull request #121 from ox-it/WL-3067

WL-3067 Correctly handle both Long and Integer.