Hello! I suppose the most direct way that comes to mind to decouple this in a standalone application is to read a file or use the environment to figure out the properties and put them into a Properties object. Then when you are configuring, use Configuration::setProperties to dynamically configure the required items prior to buildSessionFactory().
Code:
Properties p = new Properties();
// set stuff here, e.g.
// hibernate.dialect = net.sf.hibernate.dialect.Oracle9Dialect
// hibernate.connection.isolation = 3
// hibernate.connection.datasource = jndi:comp/env/jdbc/ORCL
Configuration cfg = new Configuration().setProperties( p );
SessionFactory s_SessFac = cfg.buildSessionFactory();
// etc
I suppose what you'd have to mainly change is the SQL Dialect, as there are other ways (JNDI for instance) for the database connection or pool itself.
Doesn't hibernate look in the classpath for the config file(s)? It just isn't clear to me what the exact priorities are.
Hope this helps!