-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from bd2kccd/development
Updated Spring Boot dependency version.
- Loading branch information
Showing
30 changed files
with
1,160 additions
and
1,194 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 48 additions & 50 deletions
98
src/main/java/edu/pitt/dbmi/tetrad/db/TetradDatabaseApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} | ||
|
||
} |
Oops, something went wrong.