aboutsummaryrefslogtreecommitdiffstats
path: root/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
diff options
context:
space:
mode:
Diffstat (limited to 'POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java')
-rw-r--r--POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java11
1 files changed, 7 insertions, 4 deletions
diff --git a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
index b3db51df4..9f7659d15 100644
--- a/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
+++ b/POLICY-SDK-APP/src/main/java/org/openecomp/policy/conf/HibernateSession.java
@@ -26,16 +26,19 @@ package org.openecomp.policy.conf;
* */
import java.util.Properties;
-import org.hibernate.HibernateException;
import org.hibernate.Session;
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
+import org.openecomp.policy.common.logging.flexlogger.FlexLogger;
+import org.openecomp.policy.common.logging.flexlogger.Logger;
import org.openecomp.policy.controller.PolicyController;
import org.openecomp.policy.rest.jpa.SystemLogDB;
@SuppressWarnings("deprecation")
public class HibernateSession{
+ private static final Logger LOGGER = FlexLogger.getLogger(HibernateSession.class);
+
private static SessionFactory logSessionFactory;
static {
@@ -49,11 +52,11 @@ public class HibernateSession{
prop.setProperty("show_sql", "false");
logSessionFactory = new Configuration().addPackage("org.openecomp.policy.*").addProperties(prop)
.addAnnotatedClass(SystemLogDB.class).buildSessionFactory();
- } catch (Throwable ex) {
- throw new ExceptionInInitializerError(ex);
+ } catch (Exception ex) {
+ LOGGER.error("Exception Occured while creating Log database Hibernate session"+ex);
}
}
- public static Session getSession() throws HibernateException {
+ public static Session getSession(){
return logSessionFactory.openSession();
}