Hibernate throws strange error: Class is not mapped
Instead of
Query query = session.createQuery("select p from Payment p");
try this
Query query = session.createQuery("select p from " + Payment.class.getName() + " p");
I'd expect one of two things to be the reason:
either you don't have Payment listed in your hibernat.cfg.xml or where ever you config your mapped classes.
another reason might be the confusion between javax...Entity and org.hibernate....Entity. Make sure you use the first one.