private static Configuration generateTeneoHibernateConfig(DatabaseSetupData data) { // for teneo, we need to intialize the datastore in order ot properly // init the configuration. So we set an invalid db so init will fail, // but then we can use the config to generate schema... HbDataStore tempDataStore = HbHelper.INSTANCE.createRegisterDataStore("fakedatastore"); String savedDbName = data.getDatabaseName(); data.setDatabaseName("generateschema" + data.hashCode()); String savedUserName = data.getUserName(); data.setUserName(data.hashCode() + "generateschema"); try { tempDataStore.setProperties(data.getOptions()); tempDataStore.setEPackages(EPACKAGES); tempDataStore.initialize(); } catch (Throwable t) { System.out.println("Caught expected error: " + t.getMessage()); } data.setUserName(savedUserName); data.setDatabaseName(savedDbName); Configuration configuration = tempDataStore.getHibernateConfiguration(); return configuration; }
private void initializeDataStore() { hbds = HbHelper.INSTANCE.createRegisterDataStore(data.getDatabaseName()); hbds.setProperties(data.getOptions()); hbds.setEPackages(EPACKAGES); hbds.initialize(); }