Cast fields to number via Java instead of in the query. This was breaking Hibernate's JPA implementation.

The tests were always passing since they use eclipselink's JPA implementation instead of Hibernate's.
Taken from the BlackLocus Edition of JPA-NestedSet. I think this fixes romanb/JPA-NestedSet#12.
Merge pull request #14 from blacklocus/issue-12-hibernate-jpql-badness

Cast fields to number via Java instead of in the query for Hibernate