If I dont set anything programmatically and just call Configuration configuration = new Configuration().configure();
and use the hibernate.properties (as below)
An alternate way will be load all properties from hibernate.cfg.xml
or hibernate.properties
and overwrite only the one required programmatically.
Configuration config = new Configuration().configure();
config.setProperty("hibernate.connection.username", "xyz" );
config.setProperty("hibernate.connection.password", "password" );