refactoring registration and User.class for Hibernate.