I\'m using the reverse engineering capabilities built into the eclipse hibernate plugin to generate dao\'s and hbm.xml files for each table.
It does it quite well bu
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();
cfg.configure();
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)