public void init() { Map<?, ?> properties = (Map<?, ?>) enitityManagerFactory.getProperties().get("PUnitInfo"); BasicDataSource bds = new BasicDataSource(); if (properties == null) { // test case bds.setUrl((String) enitityManagerFactory.getProperties().get("javax.persistence.jdbc.url")); bds.setPassword( (String) enitityManagerFactory.getProperties().get("javax.persistence.jdbc.password")); bds.setUsername( (String) enitityManagerFactory.getProperties().get("javax.persistence.jdbc.user")); bds.setDriverClassName( (String) enitityManagerFactory.getProperties().get("javax.persistence.jdbc.driver")); } else { bds.setUrl((String) properties.get("driverUrl")); bds.setPassword((String) properties.get("driverPassword")); bds.setUsername((String) properties.get("driverUser")); bds.setDriverClassName((String) properties.get("driverClassName")); } flyway.setDataSource(bds); flyway.setTable("skysail_server_ext_notes_schema_version"); // flyway.setLocations(); ClassLoader ccl = Thread.currentThread().getContextClassLoader(); ClassLoader thisClassLoader = this.getClass().getClassLoader(); Thread.currentThread().setContextClassLoader(thisClassLoader); flyway.setInitOnMigrate(true); flyway.migrate(); Thread.currentThread().setContextClassLoader(ccl); }
public String getCacheRegionName() { return (String) emf.getProperties().get("hibernate.cache.region_prefix"); }