Small fixes and tests related to hibernate + upgraded the hibernate
version.