use of org.hibernate.cfg.Configuration in project scheduling by ow2-proactive.
the class NodeHistoryTest method initDB.
@BeforeClass
public static void initDB() throws Exception {
PAResourceManagerProperties.RM_ALIVE_EVENT_FREQUENCY.updateProperty("100");
Configuration config = new Configuration().configure("/functionaltests/config/hibernate-unit.cfg.xml");
dbManager = new RMDBManager(config, true, true);
}
use of org.hibernate.cfg.Configuration in project scheduling by ow2-proactive.
the class SchedulerDBManager method createUsingProperties.
public static SchedulerDBManager createUsingProperties() {
if (System.getProperty(JAVA_PROPERTYNAME_NODB) != null) {
return createInMemorySchedulerDBManager();
} else {
File configFile = new File(PASchedulerProperties.getAbsolutePath(PASchedulerProperties.SCHEDULER_DB_HIBERNATE_CONFIG.getValueAsString()));
Map<String, String> propertiesToReplace = new HashMap<>(2, 1f);
propertiesToReplace.put("${proactive.home}", CentralPAPropertyRepository.PA_HOME.getValue());
propertiesToReplace.put("${pa.scheduler.home}", PASchedulerProperties.SCHEDULER_HOME.getValueAsString());
Configuration configuration = createConfiguration(configFile, propertiesToReplace);
boolean drop = PASchedulerProperties.SCHEDULER_DB_HIBERNATE_DROPDB.getValueAsBoolean();
if (logger.isInfoEnabled()) {
logger.info("Starting Scheduler DB Manager " + "with drop DB = " + drop + " and configuration file = " + configFile.getAbsolutePath());
}
return new SchedulerDBManager(configuration, drop);
}
}
use of org.hibernate.cfg.Configuration in project scheduling by ow2-proactive.
the class SchedulerDBManager method createInMemorySchedulerDBManager.
public static SchedulerDBManager createInMemorySchedulerDBManager() {
Configuration config = new Configuration();
config.setProperty("hibernate.connection.driver_class", "org.hsqldb.jdbc.JDBCDriver");
config.setProperty("hibernate.connection.url", "jdbc:hsqldb:mem:" + System.currentTimeMillis() + ";hsqldb.tx=mvcc");
config.setProperty("hibernate.dialect", "org.hibernate.dialect.HSQLDialect");
return new SchedulerDBManager(config, true);
}
use of org.hibernate.cfg.Configuration in project scheduling by ow2-proactive.
the class BaseSchedulerDBTest method initTest.
@Before
public void initTest() throws Exception {
if (System.getProperty("pa.scheduler.home") == null) {
PASchedulerProperties.SCHEDULER_HOME.updateProperty(ClasspathUtils.findSchedulerHome());
}
System.out.println("Scheduler home : " + PASchedulerProperties.SCHEDULER_HOME.getValueAsString());
PASchedulerProperties.TASK_FORK.updateProperty("true");
CentralPAPropertyRepository.PA_CLASSLOADING_USEHTTP.setValue(false);
if (inMemory) {
dbManager = SchedulerDBManager.createInMemorySchedulerDBManager();
} else {
Configuration config = new Configuration().configure(new File(this.getClass().getResource("/functionaltests/config/hibernate-unit.cfg.xml").toURI()));
dbManager = new SchedulerDBManager(config, true);
}
}
use of org.hibernate.cfg.Configuration in project hibernate-orm by hibernate.
the class BmtSfStatefulBean method start.
public void start() {
Configuration configuration = new Configuration();
configuration = configuration.configure("hibernate.cfg.xml");
configuration.addAnnotatedClass(WildFlyDdlEntity.class);
// creating the SF should run schema creation
sessionFactory = configuration.buildSessionFactory();
}
Aggregations