Problems using eclipse Hibernate plugin - could not locate sessionfactory in JNDI

You can either specify all the connection, password, username etc. directly in a hibernate configuration file, and then load using code like:

Configuration cfg = new Configuration();
SessionFactory sf = cfg.buildSessionFactory();

Or, you can obtain it from JNDI. This allows your sysadmin to change the connection, password, username etc. after deployment, by registering a different SessionFactory with JNDI.

You would need to consult your application server's documentation on how to specify JNDI resources with the application server.

Inside of buildsessionfactory method initialize initialcontext.pass the sessionfactory jndi name in the get session factory method( i.e in lookup)