You needed Hibernate.getClass because you are comparing classes instead of using instanceof. Is there any reason why you shouldn't be using instanceof as illustrated in the new User Guide.