static Configuration createConfiguration(String[] args, int index) {
String hibernateCfgXml = (args.length > index ? args[index] : "hibernate.cfg.xml");
String hibernateProperties = (args.length > (index + 1) ? args[index + 1] : null);
Configuration configuration = new Configuration();
configuration.configure(new File(hibernateCfgXml));
if (hibernateProperties != null) {
try {
Properties properties = new Properties();
InputStream inputStream = new FileInputStream(hibernateProperties);
properties.load(inputStream);