Commit 47cd4449 authored by pborate's avatar pborate

Done the changes in hibernateUtil

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@185194 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 29b36385
...@@ -7,6 +7,7 @@ import java.util.ArrayList; ...@@ -7,6 +7,7 @@ import java.util.ArrayList;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import javax.activation.DataSource;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.naming.NamingException; import javax.naming.NamingException;
...@@ -34,13 +35,17 @@ import javax.naming.InitialContext; ...@@ -34,13 +35,17 @@ import javax.naming.InitialContext;
public class DashboardUtil public class DashboardUtil
{ {
private static String siteTranDB = "DEFAULT"; private String userTranDB = "DEFAULT";
public JSONObject getDashboardConfig(String dashboardFileName,UserInfoBean userInfo) public JSONObject getDashboardConfig(String dashboardFileName,UserInfoBean userInfo)
{ {
//JSONObject dashboardConfig = new JSONObject(); //JSONObject dashboardConfig = new JSONObject();
JSONObject dashboardConfigFinal = new JSONObject(); JSONObject dashboardConfigFinal = new JSONObject();
try try
{ {
if(userInfo != null) {
userTranDB =userInfo.getTransDB();
}
System.out.println("userTranDB =" + userTranDB);
CommonConstants.setIBASEHOME(); CommonConstants.setIBASEHOME();
System.out.println("Inside getDashboardConfig :: CommonConstants.JBOSSHOME ["+CommonConstants.JBOSSHOME+"]"); System.out.println("Inside getDashboardConfig :: CommonConstants.JBOSSHOME ["+CommonConstants.JBOSSHOME+"]");
...@@ -60,7 +65,7 @@ public class DashboardUtil ...@@ -60,7 +65,7 @@ public class DashboardUtil
System.out.println("The final dashboard config" + dashboardConfigFinal); System.out.println("The final dashboard config" + dashboardConfigFinal);
return dashboardConfigFinal; return dashboardConfigFinal;
} }
private JSONObject processMetadataXML(String dashboardFileContents,UserInfoBean userInfo) throws NamingException, Exception private JSONObject processMetadataXML(String dashboardFileContents,UserInfoBean userInfo) throws NamingException, Exception
{ {
...@@ -211,8 +216,8 @@ public class DashboardUtil ...@@ -211,8 +216,8 @@ public class DashboardUtil
if(dataSourceType.equalsIgnoreCase("dataModel")) { if(dataSourceType.equalsIgnoreCase("dataModel")) {
try try
{ {
Session session = HibernateUtil.getSessionFactory(siteTranDB).openSession(); Session session = HibernateUtil.getSessionFactory(userTranDB).openSession();
// 2. Create Query // 2. Create Query
Query query = session.createSQLQuery(" select scope_name from data_model_input" Query query = session.createSQLQuery(" select scope_name from data_model_input"
+ " where data_model='"+value+"'"); + " where data_model='"+value+"'");
...@@ -709,8 +714,10 @@ public class DashboardUtil ...@@ -709,8 +714,10 @@ public class DashboardUtil
try try
{ {
// 1. Get Session object // 1. Get Session object
Session session = HibernateUtil.getSessionFactory().openSession();
System.out.println("fetchAllPophelpData fieldName ["+colName+"] modName ["+modName+"]"); System.out.println("fetchAllPophelpData fieldName ["+colName+"] modName ["+modName+"]");
Session session = HibernateUtil.getSessionFactory(userTranDB).openSession();
// Session session = HibernateUtil.getSessionFactory().openSession();
// 2. Create Query // 2. Create Query
Query query = session.createQuery("from Pophelp WHERE fieldName=UPPER('"+colName+"') and" Query query = session.createQuery("from Pophelp WHERE fieldName=UPPER('"+colName+"') and"
+ " modName = UPPER('w_"+modName+"')"); + " modName = UPPER('w_"+modName+"')");
......
...@@ -13,7 +13,6 @@ import org.hibernate.boot.MetadataSources; ...@@ -13,7 +13,6 @@ import org.hibernate.boot.MetadataSources;
import org.hibernate.boot.registry.StandardServiceRegistry; import org.hibernate.boot.registry.StandardServiceRegistry;
import org.hibernate.boot.registry.StandardServiceRegistryBuilder; import org.hibernate.boot.registry.StandardServiceRegistryBuilder;
import org.hibernate.cfg.Configuration; import org.hibernate.cfg.Configuration;
import org.hibernate.service.ServiceRegistry;
import ibase.utility.CommonConstants; import ibase.utility.CommonConstants;
public class HibernateUtil public class HibernateUtil
...@@ -24,7 +23,7 @@ public class HibernateUtil ...@@ -24,7 +23,7 @@ public class HibernateUtil
try try
{ {
//String hibernetCfgPath = "hibernate.cfg.xml"; //String hibernetCfgPath = "hibernate.cfg.xml";
String hibernetCfgPath = CommonConstants.JBOSSHOME+File.separator+"server"+File.separator+"default"+File.separator+"deploy"+File.separator+"ibase.ear"+File.separator+"ibase.war"+File.separator+"setting"+File.separator+"hibernate.cfg.xml"; String hibernetCfgPath = CommonConstants.JBOSSHOME+File.separator+"server"+File.separator+"default"+File.separator+"deploy"+File.separator+"ibase.ear"+File.separator+"ibase.war"+File.separator+"setting"+File.separator+"hibernate.cfg.xml";
//String hibernetCfgPath ="/home/base/OfficeWork/eclipseWS/PlaceTimeEntityWebService/hibernate.cfg.xml"; //String hibernetCfgPath ="/home/base/OfficeWork/eclipseWS/PlaceTimeEntityWebService/hibernate.cfg.xml";
System.out.println("path for cfg file is ===="+hibernetCfgPath); System.out.println("path for cfg file is ===="+hibernetCfgPath);
File file = new File(hibernetCfgPath); File file = new File(hibernetCfgPath);
...@@ -66,7 +65,7 @@ public class HibernateUtil ...@@ -66,7 +65,7 @@ public class HibernateUtil
try try
{ {
//String hibernetCfgPath = "hibernate.cfg.xml"; //String hibernetCfgPath = "hibernate.cfg.xml";
String hibernetCfgPath = CommonConstants.JBOSSHOME+File.separator+"server"+File.separator+"default"+File.separator+"deploy"+File.separator+"ibase.ear"+File.separator+"ibase.war"+File.separator+"setting"+File.separator+"hibernate.cfg.xml"; String hibernetCfgPath = CommonConstants.JBOSSHOME+File.separator+"server"+File.separator+"default"+File.separator+"deploy"+File.separator+"ibase.ear"+File.separator+"ibase.war"+File.separator+"setting"+File.separator+"hibernate."+dbName+".xml";
//String hibernetCfgPath ="/home/base/OfficeWork/eclipseWS/PlaceTimeEntityWebService/hibernate.cfg.xml"; //String hibernetCfgPath ="/home/base/OfficeWork/eclipseWS/PlaceTimeEntityWebService/hibernate.cfg.xml";
System.out.println("path for cfg file is ===="+hibernetCfgPath); System.out.println("path for cfg file is ===="+hibernetCfgPath);
...@@ -98,10 +97,12 @@ public class HibernateUtil ...@@ -98,10 +97,12 @@ public class HibernateUtil
System.out.println("Inside getSessionFactory method :::"+dbName); System.out.println("Inside getSessionFactory method :::"+dbName);
if( "DEFAULT".equalsIgnoreCase(dbName) ) if( "DEFAULT".equalsIgnoreCase(dbName) )
{ {
/*
if(getSessionFactory().isClosed()) if(getSessionFactory().isClosed())
{ {
buildSessionFactory(dbName); buildSessionFactory(dbName);
} }
*/
return getSessionFactory(); return getSessionFactory();
} }
else else
...@@ -194,5 +195,4 @@ public class HibernateUtil ...@@ -194,5 +195,4 @@ public class HibernateUtil
} }
/* Added By Saitej Dhaul On 18 Dec 2018 END */ /* Added By Saitej Dhaul On 18 Dec 2018 END */
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment