org.hibernate.internal.util.config.ConfigurationException: Could not locate cfg.xml resource [/HibernateTest/src/hibernate.cfg.xml]

If you have your hibernate.cfg.xml in the root of the source folder, just do

SessionFactory sessionFactory = new Configuration().configure().buildSessionFactory();

If it is in the package, for an example in the org.nitish.caller, specify path by this way

 SessionFactory sessionFactory = new Configuration()
    .configure("/org/nitish/caller/hibernate.cfg.xml").buildSessionFactory();

You need to close the session (in the finally block). Don't forget to add rollback code.

Please, add @Table annotation to the UserDetails.

Update

The reason of the error that Hibernate can't find org.postgresql.Driver class. It resides in postgresql jar. You have that jar at your image, but may be you don't add it to the classpath. Refer How to Add JARs to Project Build Paths in Eclipse (Java).

To close a session in the finally block you need to have session variable outside the try block.

    Session session = sessionFactory.openSession();

    try{

    } finally {
        session.close();
   }

I fixed this by moving my config file to src/main/resources. This is the standard directory for configuration files like hibernate.cfg.xml or hibernate.properties or application related properties files.