You can use someting like below to configure properties at runtime
Code:
Configuration c = new Configuration();
Properties p = new Properties();
p.put( "hibernate.connection.driver_class", "oracle.jdbc.OracleDriver" );
p.put( "hibernate.connection.url", "jdbc:oracle:thin:@localhost:1521:MYDB" );
p.put( "hibernate.connection.username", "myuser" );
p.put( "hibernate.connection.password", "mypaswd" );
p.put( "hibernate.transaction.auto_close_session", "false" );
p.put( "hibernate.connection.pool_size", "1" );
c.configure(); // will load properties from hibernate.cfg.xml
c.addProperties( p );
SessionFactory sf = c.buildSessionFactory();