Skip to content

Commit

Permalink
Merge pull request #7 from bd2kccd/development
Browse files Browse the repository at this point in the history
Updated Spring Boot dependency version.
  • Loading branch information
kvb2univpitt authored Mar 30, 2017
2 parents 86aea44 + c8b805f commit d249371
Show file tree
Hide file tree
Showing 30 changed files with 1,160 additions and 1,194 deletions.
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>edu.pitt.dbmi</groupId>
<artifactId>tetrad-db</artifactId>
<version>0.0.1-SNAPSHOT</version>
<version>0.0.1</version>
<packaging>jar</packaging>

<name>tetrad-db</name>
Expand All @@ -13,7 +13,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.2.RELEASE</version>
<version>1.4.5.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,82 +1,80 @@
package edu.pitt.dbmi.tetrad.db;

import java.util.Date;

import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParamRequest;
import edu.pitt.dbmi.tetrad.db.entity.AlgorithmParameter;
import edu.pitt.dbmi.tetrad.db.entity.HpcAccount;
import edu.pitt.dbmi.tetrad.db.entity.DataValidation;
import edu.pitt.dbmi.tetrad.db.entity.HpcAccount;
import edu.pitt.dbmi.tetrad.db.entity.HpcJobInfo;
import edu.pitt.dbmi.tetrad.db.entity.HpcJobLog;
import edu.pitt.dbmi.tetrad.db.entity.HpcJobLogDetail;
import edu.pitt.dbmi.tetrad.db.entity.HpcParameter;
import edu.pitt.dbmi.tetrad.db.entity.JvmOption;
import java.util.Date;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;

/**
*
*
* Oct 24, 2016 5:21:16 PM
*
*
* @author Chirayu (Kong) Wongchokprasitti, PhD
*
*
*/
public class TetradDatabaseApplication {

private static final SessionFactory sessionFactory;

static {
try {
Configuration configuration = new Configuration();
// Mapping
configuration.addAnnotatedClass(AlgorithmParameter.class);
configuration.addAnnotatedClass(AlgorithmParamRequest.class);
configuration.addAnnotatedClass(DataValidation.class);
configuration.addAnnotatedClass(HpcAccount.class);
configuration.addAnnotatedClass(HpcJobInfo.class);
configuration.addAnnotatedClass(HpcJobLog.class);
configuration.addAnnotatedClass(HpcJobLogDetail.class);
configuration.addAnnotatedClass(JvmOption.class);
configuration.addAnnotatedClass(HpcParameter.class);
ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable e) {
System.err.println(e.getMessage());
throw new ExceptionInInitializerError(e);
}
try {
Configuration configuration = new Configuration();
// Mapping
configuration.addAnnotatedClass(AlgorithmParameter.class);
configuration.addAnnotatedClass(AlgorithmParamRequest.class);
configuration.addAnnotatedClass(DataValidation.class);
configuration.addAnnotatedClass(HpcAccount.class);
configuration.addAnnotatedClass(HpcJobInfo.class);
configuration.addAnnotatedClass(HpcJobLog.class);
configuration.addAnnotatedClass(HpcJobLogDetail.class);
configuration.addAnnotatedClass(JvmOption.class);
configuration.addAnnotatedClass(HpcParameter.class);

ServiceRegistry serviceRegistry = new StandardServiceRegistryBuilder().build();
sessionFactory = configuration.buildSessionFactory(serviceRegistry);
} catch (Throwable e) {
System.err.println(e.getMessage());
throw new ExceptionInInitializerError(e);
}
}

public static SessionFactory getSessionFactory() {
return sessionFactory;
return sessionFactory;
}

public static void shutdown() {
sessionFactory.close();
sessionFactory.close();
}

public static void main(String[] args) {
Session session = TetradDatabaseApplication.getSessionFactory()
.openSession();
session.beginTransaction();
public static void main(String[] args) {
Session session = TetradDatabaseApplication.getSessionFactory()
.openSession();
session.beginTransaction();

HpcAccount computingAccount = new HpcAccount();
computingAccount.setConnectionName("psc");
computingAccount.setUsername("");
computingAccount.setPassword("");
computingAccount.setScheme("https");
computingAccount.setHostname("");
computingAccount.setPort(443);
computingAccount.setCreatedDate(new Date());
session.save(computingAccount);
HpcAccount computingAccount = new HpcAccount();
computingAccount.setConnectionName("psc");
computingAccount.setUsername("");
computingAccount.setPassword("");
computingAccount.setScheme("https");
computingAccount.setHostname("");
computingAccount.setPort(443);
computingAccount.setCreatedDate(new Date());
session.save(computingAccount);

session.getTransaction().commit();
session.close();
TetradDatabaseApplication.shutdown();
session.getTransaction().commit();
session.close();
TetradDatabaseApplication.shutdown();
}

}
Loading

0 comments on commit d249371

Please sign in to comment.