unable to get Criteria.list using hibernate? - java
i just want a list of data using hibernate but by calling below method my code get stuck somewhere and automatically my CPU usage becomes 100 %
List<TbDiscussionForumAnswere> tbdAnsList = tbDiscussionForumDao.findTbDiscussionForumAnswerebyforumQuestionId(questionId);
next function is
public List<TbDiscussionForumAnswere> findTbDiscussionForumAnswerebyforumQuestionId(Integer forumQuestionId) {
session = sessionFactory.getCurrentSession();
Criteria criteria=session.createCriteria(TbDiscussionForumAnswere.class);
criteria.createAlias("forumQuestionId", "form");
criteria.add(Restrictions.eq("form.forumQuestionId", forumQuestionId));
return criteria.list();
}
by calling above method my code got stuck and automaticlly cpu usage up to 100% code from entity is
#JoinColumn(name = "ForumQuestionId", referencedColumnName = "ForumQuestionId")
#ManyToOne
private TbDiscussionForumQuestion forumQuestionId;
another one is
#Column(name = "ForumQuestionId")
private Integer forumQuestionId;
below is my hibernate log but i unable to understand
select
forumanswe0_.Answere_Id as Answere_2_92_0_,
forumanswe0_.Id as Id1_42_0_,
forumanswe0_.Id as Id1_42_1_,
forumanswe0_.Answere_Id as Answere_2_42_1_,
forumanswe0_.Case_Id as Case_Id3_42_1_,
forumanswe0_.Resource_Id as Resource4_42_1_,
case1x1_.Case_Id as Case_Id1_8_2_,
case1x1_.Age as Age2_8_2_,
case1x1_.Atelectasis as Atelecta3_8_2_,
case1x1_.BaseLine_CA125 as BaseLine4_8_2_,
case1x1_.Brca as Brca5_8_2_,
case1x1_.Cancer_Sub_Type_Id as Cancer110_8_2_,
case1x1_.Cancer_Type_Id as Cancer111_8_2_,
case1x1_.Case_HER2neu_Amplified as Case_HER6_8_2_,
case1x1_.Chief_Complaint as Chief_Co7_8_2_,
case1x1_.Clinical_Stage as Clinical8_8_2_,
case1x1_.Clinical_Staging_Method as Clinical9_8_2_,
case1x1_.Closest_Margins as Closest10_8_2_,
case1x1_.Date_First_Encounter as Date_Fi11_8_2_,
case1x1_.Date_Recurrence as Date_Re12_8_2_,
case1x1_.Debulking_Status as Debulki13_8_2_,
case1x1_.Deceased_Due_BC as Decease14_8_2_,
case1x1_.Disease_Propagation as Disease15_8_2_,
case1x1_.disease_sub_type_id as diseas112_8_2_,
case1x1_.Disease_Treated as Disease16_8_2_,
case1x1_.Disease_type as Diseas113_8_2_,
case1x1_.dist as dist17_8_2_,
case1x1_.Distant_Mets as Distant18_8_2_,
case1x1_.Distant_Mets_Comm as Distant19_8_2_,
case1x1_.Dt_Death as Dt_Deat20_8_2_,
case1x1_.Duration_Of_Symptoms_Mon as Duratio21_8_2_,
case1x1_.ER_Percent as ER_Perc22_8_2_,
case1x1_.ER_Status as ER_Stat23_8_2_,
case1x1_.Esophageal_C_Staging_Method as Esophag24_8_2_,
case1x1_.Esophagectomy_Done as Esophag25_8_2_,
case1x1_.Final_TNM_Stage_Id as Final_114_8_2_,
case1x1_.functional_status as functi115_8_2_,
case1x1_.GYN_Oncologist as GYN_Onc26_8_2_,
case1x1_.Genetics as Geneti116_8_2_,
case1x1_.Genomics as Genomi117_8_2_,
case1x1_.Gleason_Score as Gleason27_8_2_,
case1x1_.HER2_Status as HER28_8_2_,
case1x1_.HER2_SISH as HER29_8_2_,
case1x1_.Histological_Grade as Histolo30_8_2_,
case1x1_.ido as ido31_8_2_,
case1x1_.Immune_Histochemistry as Immune_32_8_2_,
case1x1_.Interval_Debulking_Dt as Interva33_8_2_,
case1x1_.Invasion_In_Mediastnum as Invasio34_8_2_,
case1x1_.Invasion_Into_Carina as Invasio35_8_2_,
case1x1_.Invasion_Into_Esophagus as Invasio36_8_2_,
case1x1_.Invasion_Into_Great_Vessels as Invasio37_8_2_,
case1x1_.Invasion_Into_Heart as Invasio38_8_2_,
case1x1_.Invasion_Into_Rec_Laryngeal_Nerve as Invasio39_8_2_,
case1x1_.Invasion_Into_Trachea as Invasio40_8_2_,
case1x1_.Invasion_Into_Vertbral_Body as Invasio41_8_2_,
case1x1_.Invasion_Of_Adj_Structure as Invasio42_8_2_,
case1x1_.Invasion_Of_Chest_Wall as Invasio43_8_2_,
case1x1_.Invasion_Of_Diaphragm as Invasio44_8_2_,
case1x1_.Invasion_Of_Main_Bronchus as Invasio45_8_2_,
case1x1_.Invasion_Of_Pericardium as Invasio46_8_2_,
case1x1_.Invasion_Of_Phrenic_Nerve as Invasio47_8_2_,
case1x1_.Invasion_Of_Pleura as Invasio48_8_2_,
case1x1_.Later as Later49_8_2_,
case1x1_.lesion_depth as lesion_50_8_2_,
case1x1_.Lymfovascular_Invasion as Lymfova51_8_2_,
case1x1_.Margins as Margins52_8_2_,
case1x1_.Med_Onc_Physician_Id as Med_On118_8_2_,
case1x1_.Menopause_Status as Menopau53_8_2_,
case1x1_.met_primary as met_pri54_8_2_,
case1x1_.met_primary_site as met_pri55_8_2_,
case1x1_.metastasis as metasta56_8_2_,
case1x1_.Metastatic as Metasta57_8_2_,
case1x1_.mi as mi58_8_2_,
case1x1_.mucosal_invasion as mucosal59_8_2_,
case1x1_.nd_Primary as nd_Prim60_8_2_,
case1x1_.Necrosis_Percent as Necrosi61_8_2_,
case1x1_.Necrosis_Present as Necrosi62_8_2_,
case1x1_.NeoadjResponse as NeoadjR63_8_2_,
case1x1_.nln as nln64_8_2_,
case1x1_.No_Fossi as No_Foss65_8_2_,
case1x1_.No_Nodes as No_Node66_8_2_,
case1x1_.Nodal_Metastases as Nodal_M67_8_2_,
case1x1_.nv_inf as nv_inf68_8_2_,
case1x1_.nyso as nyso69_8_2_,
case1x1_.Obstractive_Pneumonitis as Obstrac70_8_2_,
case1x1_.OncDxScore as OncDxSc71_8_2_,
case1x1_.other_biomarkers as other_b72_8_2_,
case1x1_.Overall_Survival as Overall73_8_2_,
case1x1_.PR_Percent as PR_Perc74_8_2_,
case1x1_.PR_Status as PR_Stat75_8_2_,
case1x1_.pathologist as patholo76_8_2_,
case1x1_.Patient_Id as Patien119_8_2_,
case1x1_.Plastic_Surgeon_Id as Plasti120_8_2_,
case1x1_.Platin_Status as Platin_77_8_2_,
case1x1_.pleural_Inv as pleural78_8_2_,
case1x1_.Prg_Free_Survival as Prg_Fre79_8_2_,
case1x1_.Primary_Diagnosis_Dt as Primary80_8_2_,
case1x1_.Rad_Onc_Physician_Id as Rad_On121_8_2_,
case1x1_.Reason_Not_Treated as Reason_81_8_2_,
case1x1_.Recurrence as Recurre82_8_2_,
case1x1_.ref_Physician as ref_Phy83_8_2_,
case1x1_.Reference_Institution as Refere122_8_2_,
case1x1_.Refering_Physicia_Id as Referi123_8_2_,
case1x1_.Residual_Tumor as Residua84_8_2_,
case1x1_.Secondary_Debulking_Date as Seconda85_8_2_,
case1x1_.Seen_On_Bonescan as Seen_On86_8_2_,
case1x1_.Seen_On_CT as Seen_On87_8_2_,
case1x1_.Seen_On_MRI as Seen_On88_8_2_,
case1x1_.Seen_On_PAT as Seen_On89_8_2_,
case1x1_.Seen_On_Thallium_Scan as Seen_On90_8_2_,
case1x1_.Seen_On_Xray as Seen_On91_8_2_,
case1x1_.Separate_TNode_In_Same_Lobe as Separat92_8_2_,
case1x1_.Significance_Comorbities as Signifi93_8_2_,
case1x1_.Significance_Risk as Signifi94_8_2_,
case1x1_.st_Primary as st_Prim95_8_2_,
case1x1_.Surg_Onc_Physician_Id as Surg_O124_8_2_,
case1x1_.t_location as t_locat96_8_2_,
case1x1_.TNodes_In_Diff_Lobe as TNodes_97_8_2_,
case1x1_.t_rupture as t_ruptu98_8_2_,
case1x1_.tis_bank as tis_ban99_8_2_,
case1x1_.tis_bank_odunsi as tis_ba100_8_2_,
case1x1_.tis_bank_pnr as tis_ba101_8_2_,
case1x1_.Treatment_Related_Death as Treatm102_8_2_,
case1x1_.Tumor_Depth as Tumor_103_8_2_,
case1x1_.Tumor_Size as Tumor_104_8_2_,
case1x1_.tumor_type as tumor_105_8_2_,
case1x1_.Unrelated_Death as Unrela106_8_2_,
case1x1_.version as versio107_8_2_,
case1x1_.WHO_Classification as WHO_Cl108_8_2_,
case1x1_.Working_TNM_Stage_Id as Workin125_8_2_,
case1x1_.wt as wt109_8_2_,
cancersubt2_.Can_Sub_Type_Id as Can_Sub_1_5_3_,
cancersubt2_.Cancer_Type_Id as Cancer_T3_5_3_,
cancersubt2_.Name as Name2_5_3_,
cancertype3_.Can_Type_Id as Can_Type1_6_4_,
cancertype3_.CName as CName2_6_4_,
cancertype3_.Comments as Comments3_6_4_,
cancertype3_.disease_sub_type_id as disease_4_6_4_,
cancertype3_.disease_type_Id as disease_5_6_4_,
diseasesub4_.Disease_Sub_Type_Id as Disease_1_25_5_,
diseasesub4_.Creation_Time as Creation2_25_5_,
diseasesub4_.Disease_Sub_Name as Disease_3_25_5_,
diseasesub4_.Disease_Type_Id as Disease_5_25_5_,
diseasesub4_.Modifcation_Time as Modifcat4_25_5_,
diseasetyp5_.Disease_Type_Id as Disease_1_26_6_,
diseasetyp5_.Disease_Name as Disease_2_26_6_,
diseasetyp6_.Disease_Type_Id as Disease_1_26_7_,
diseasetyp6_.Disease_Name as Disease_2_26_7_,
cancertype7_.Can_Type_Id as Can_Type1_6_8_,
cancertype7_.CName as CName2_6_8_,
cancertype7_.Comments as Comments3_6_8_,
cancertype7_.disease_sub_type_id as disease_4_6_8_,
cancertype7_.disease_type_Id as disease_5_6_8_,
diseasesub8_.Disease_Sub_Type_Id as Disease_1_25_9_,
diseasesub8_.Creation_Time as Creation2_25_9_,
diseasesub8_.Disease_Sub_Name as Disease_3_25_9_,
diseasesub8_.Disease_Type_Id as Disease_5_25_9_,
diseasesub8_.Modifcation_Time as Modifcat4_25_9_,
diseasetyp9_.Disease_Type_Id as Disease_1_26_10_,
diseasetyp9_.Disease_Name as Disease_2_26_10_,
tnmstage10_.Stage_Id as Stage_Id1_96_11_,
tnmstage10_.Value as Value2_96_11_,
functional11_.Id as Id1_44_12_,
functional11_.Status as Status2_44_12_,
genetics12_.Id as Id1_46_13_,
genetics12_.GnName as GnName2_46_13_,
gemonics13_.Id as Id1_45_14_,
gemonics13_.GName as GName2_45_14_,
physician14_.Physician_Id as Physicia1_60_15_,
physician14_.Cancer_Type_Id as Cancer_T9_60_15_,
physician14_.Disease_Type_Id as Disease10_60_15_,
physician14_.EMailId as EMailId2_60_15_,
physician14_.Facility_Id as Facilit11_60_15_,
physician14_.FNAME as FNAME3_60_15_,
physician14_.LNAME as LNAME4_60_15_,
physician14_.MINIT as MINIT5_60_15_,
physician14_.PhoneNo as PhoneNo6_60_15_,
physician14_.Phy_Group as Phy_Grou7_60_15_,
physician14_.Profile_Image as Profile_8_60_15_,
physician14_.Specialty as Special12_60_15_,
cancertype15_.Can_Type_Id as Can_Type1_6_16_,
cancertype15_.CName as CName2_6_16_,
cancertype15_.Comments as Comments3_6_16_,
cancertype15_.disease_sub_type_id as disease_4_6_16_,
cancertype15_.disease_type_Id as disease_5_6_16_,
diseasetyp16_.Disease_Type_Id as Disease_1_26_17_,
diseasetyp16_.Disease_Name as Disease_2_26_17_,
carefacili17_.Facility_Id as Facility1_7_18_,
carefacili17_.Center_Type_Id as Center_T7_7_18_,
carefacili17_.Facility_Address as Facility2_7_18_,
carefacili17_.Facility_City as Facility3_7_18_,
carefacili17_.Facility_Name as Facility4_7_18_,
carefacili17_.Facility_State as Facility5_7_18_,
carefacili17_.Facility_Type_Type as Facility8_7_18_,
carefacili17_.Facility_Zip as Facility6_7_18_,
carefacili17_.NQMBC_Certiification_Level_Id as NQMBC_Ce9_7_18_,
breastcanc18_.Center_type_Id as Center_t1_2_19_,
breastcanc18_.Center_Type_Description as Center_T2_2_19_,
facilityty19_.Type_Id as Type_Id1_39_20_,
facilityty19_.FName as FName2_39_20_,
nqmbclevel20_.Level_Id as Level_Id1_52_21_,
nqmbclevel20_.LName as LName2_52_21_,
physicians21_.Type_Id as Type_Id1_61_22_,
physicians21_.Name as Name2_61_22_,
patient22_.Patient_Id as Patient_1_56_23_,
patient22_.Active as Active2_56_23_,
patient22_.Address as Address3_56_23_,
patient22_.Birth_Date as Birth_Da4_56_23_,
patient22_.Cell_Phone_Number as Cell_Pho5_56_23_,
patient22_.City as City6_56_23_,
patient22_.Emergency_Contact_Name as Emergenc7_56_23_,
patient22_.Emergency_Contact_Phone_Number as Emergenc8_56_23_,
patient22_.Employement_Type as Employem9_56_23_,
patient22_.Ethnicity as Ethnici10_56_23_,
patient22_.FName as FName11_56_23_,
patient22_.Functional_Status as Functio24_56_23_,
patient22_.Gender as Gender12_56_23_,
patient22_.Increase_Risk as Increas13_56_23_,
patient22_.Insurance_Name as Insuran14_56_23_,
patient22_.LName as LName15_56_23_,
patient22_.MName as MName16_56_23_,
patient22_.Mammographic_Breast_Density as Mammogr17_56_23_,
patient22_.MedRecNo as MedRecN18_56_23_,
patient22_.Patient_Concerns as Patient19_56_23_,
patient22_.Phone_Number as Phone_N20_56_23_,
patient22_.Race as Race25_56_23_,
patient22_.Status as Status21_56_23_,
patient22_.Work_Phone_Number as Work_Ph22_56_23_,
patient22_.zipcode as zipcode23_56_23_,
functional23_.Id as Id1_44_24_,
functional23_.Status as Status2_44_24_,
race24_.Type_Id as Type_Id1_69_25_,
race24_.Race as Race2_69_25_,
physician25_.Physician_Id as Physicia1_60_26_,
physician25_.Cancer_Type_Id as Cancer_T9_60_26_,
physician25_.Disease_Type_Id as Disease10_60_26_,
physician25_.EMailId as EMailId2_60_26_,
physician25_.Facility_Id as Facilit11_60_26_,
physician25_.FNAME as FNAME3_60_26_,
physician25_.LNAME as LNAME4_60_26_,
physician25_.MINIT as MINIT5_60_26_,
physician25_.PhoneNo as PhoneNo6_60_26_,
physician25_.Phy_Group as Phy_Grou7_60_26_,
physician25_.Profile_Image as Profile_8_60_26_,
physician25_.Specialty as Special12_60_26_,
physician26_.Physician_Id as Physicia1_60_27_,
physician26_.Cancer_Type_Id as Cancer_T9_60_27_,
physician26_.Disease_Type_Id as Disease10_60_27_,
physician26_.EMailId as EMailId2_60_27_,
physician26_.Facility_Id as Facilit11_60_27_,
physician26_.FNAME as FNAME3_60_27_,
physician26_.LNAME as LNAME4_60_27_,
physician26_.MINIT as MINIT5_60_27_,
physician26_.PhoneNo as PhoneNo6_60_27_,
physician26_.Phy_Group as Phy_Grou7_60_27_,
physician26_.Profile_Image as Profile_8_60_27_,
physician26_.Specialty as Special12_60_27_,
carefacili27_.Facility_Id as Facility1_7_28_,
carefacili27_.Center_Type_Id as Center_T7_7_28_,
carefacili27_.Facility_Address as Facility2_7_28_,
carefacili27_.Facility_City as Facility3_7_28_,
carefacili27_.Facility_Name as Facility4_7_28_,
carefacili27_.Facility_State as Facility5_7_28_,
carefacili27_.Facility_Type_Type as Facility8_7_28_,
carefacili27_.Facility_Zip as Facility6_7_28_,
carefacili27_.NQMBC_Certiification_Level_Id as NQMBC_Ce9_7_28_,
physician28_.Physician_Id as Physicia1_60_29_,
physician28_.Cancer_Type_Id as Cancer_T9_60_29_,
physician28_.Disease_Type_Id as Disease10_60_29_,
physician28_.EMailId as EMailId2_60_29_,
physician28_.Facility_Id as Facilit11_60_29_,
physician28_.FNAME as FNAME3_60_29_,
physician28_.LNAME as LNAME4_60_29_,
physician28_.MINIT as MINIT5_60_29_,
physician28_.PhoneNo as PhoneNo6_60_29_,
physician28_.Phy_Group as Phy_Grou7_60_29_,
physician28_.Profile_Image as Profile_8_60_29_,
physician28_.Specialty as Special12_60_29_,
physician29_.Physician_Id as Physicia1_60_30_,
physician29_.Cancer_Type_Id as Cancer_T9_60_30_,
physician29_.Disease_Type_Id as Disease10_60_30_,
physician29_.EMailId as EMailId2_60_30_,
physician29_.Facility_Id as Facilit11_60_30_,
physician29_.FNAME as FNAME3_60_30_,
physician29_.LNAME as LNAME4_60_30_,
physician29_.MINIT as MINIT5_60_30_,
physician29_.PhoneNo as PhoneNo6_60_30_,
physician29_.Phy_Group as Phy_Grou7_60_30_,
physician29_.Profile_Image as Profile_8_60_30_,
physician29_.Specialty as Special12_60_30_,
tnmstage30_.Stage_Id as Stage_Id1_96_31_,
tnmstage30_.Value as Value2_96_31_,
medikmreso31_.Resourse_Id as Resourse1_50_32_,
medikmreso31_.answer_id as answer_i2_50_32_,
medikmreso31_.Date_Of_Posted as Date_Of_3_50_32_,
medikmreso31_.Description as Descript4_50_32_,
medikmreso31_.DiseaseType as Disease14_50_32_,
medikmreso31_.Evidence_Level as Evidence5_50_32_,
medikmreso31_.External_Url as External6_50_32_,
medikmreso31_.File_Name as File_Nam7_50_32_,
medikmreso31_.Keywords as Keywords8_50_32_,
medikmreso31_.Name as Name9_50_32_,
medikmreso31_.Provider_ID as Provide15_50_32_,
medikmreso31_.Publication_Year as Publica10_50_32_,
medikmreso31_.Source as Source11_50_32_,
medikmreso31_.Type as Type12_50_32_,
medikmreso31_.Visibility as Visibil13_50_32_,
diseasetyp32_.Disease_Type_Id as Disease_1_26_33_,
diseasetyp32_.Disease_Name as Disease_2_26_33_,
physician33_.Physician_Id as Physicia1_60_34_,
physician33_.Cancer_Type_Id as Cancer_T9_60_34_,
physician33_.Disease_Type_Id as Disease10_60_34_,
physician33_.EMailId as EMailId2_60_34_,
physician33_.Facility_Id as Facilit11_60_34_,
physician33_.FNAME as FNAME3_60_34_,
physician33_.LNAME as LNAME4_60_34_,
physician33_.MINIT as MINIT5_60_34_,
physician33_.PhoneNo as PhoneNo6_60_34_,
physician33_.Phy_Group as Phy_Grou7_60_34_,
physician33_.Profile_Image as Profile_8_60_34_,
physician33_.Specialty as Special12_60_34_
from
forum_answere_resources forumanswe0_
inner join
case1 case1x1_
on forumanswe0_.Case_Id=case1x1_.Case_Id
left outer join
cancer_sub_type cancersubt2_
on case1x1_.Cancer_Sub_Type_Id=cancersubt2_.Can_Sub_Type_Id
left outer join
cancer_type cancertype3_
on cancersubt2_.Cancer_Type_Id=cancertype3_.Can_Type_Id
left outer join
disease_sub_type diseasesub4_
on cancertype3_.disease_sub_type_id=diseasesub4_.Disease_Sub_Type_Id
left outer join
disease_type diseasetyp5_
on diseasesub4_.Disease_Type_Id=diseasetyp5_.Disease_Type_Id
left outer join
disease_type diseasetyp6_
on cancertype3_.disease_type_Id=diseasetyp6_.Disease_Type_Id
left outer join
cancer_type cancertype7_
on case1x1_.Cancer_Type_Id=cancertype7_.Can_Type_Id
left outer join
disease_sub_type diseasesub8_
on case1x1_.disease_sub_type_id=diseasesub8_.Disease_Sub_Type_Id
inner join
disease_type diseasetyp9_
on case1x1_.Disease_type=diseasetyp9_.Disease_Type_Id
left outer join
tnm_stage tnmstage10_
on case1x1_.Final_TNM_Stage_Id=tnmstage10_.Stage_Id
left outer join
functionalstatus functional11_
on case1x1_.functional_status=functional11_.Id
left outer join
genetics genetics12_
on case1x1_.Genetics=genetics12_.Id
left outer join
gemonics gemonics13_
on case1x1_.Genomics=gemonics13_.Id
left outer join
physician physician14_
on case1x1_.Med_Onc_Physician_Id=physician14_.Physician_Id
left outer join
cancer_type cancertype15_
on physician14_.Cancer_Type_Id=cancertype15_.Can_Type_Id
left outer join
disease_type diseasetyp16_
on physician14_.Disease_Type_Id=diseasetyp16_.Disease_Type_Id
left outer join
care_facility carefacili17_
on physician14_.Facility_Id=carefacili17_.Facility_Id
left outer join
breast_cancer_center_type breastcanc18_
on carefacili17_.Center_Type_Id=breastcanc18_.Center_type_Id
left outer join
facility_type facilityty19_
on carefacili17_.Facility_Type_Type=facilityty19_.Type_Id
left outer join
nqmbc_level nqmbclevel20_
on carefacili17_.NQMBC_Certiification_Level_Id=nqmbclevel20_.Level_Id
left outer join
physician_speciality physicians21_
on physician14_.Specialty=physicians21_.Type_Id
inner join
patient patient22_
on case1x1_.Patient_Id=patient22_.Patient_Id
left outer join
functionalstatus functional23_
on patient22_.Functional_Status=functional23_.Id
left outer join
race race24_
on patient22_.Race=race24_.Type_Id
left outer join
physician physician25_
on case1x1_.Plastic_Surgeon_Id=physician25_.Physician_Id
left outer join
physician physician26_
on case1x1_.Rad_Onc_Physician_Id=physician26_.Physician_Id
left outer join
care_facility carefacili27_
on case1x1_.Reference_Institution=carefacili27_.Facility_Id
left outer join
physician physician28_
on case1x1_.Refering_Physicia_Id=physician28_.Physician_Id
left outer join
physician physician29_
on case1x1_.Surg_Onc_Physician_Id=physician29_.Physician_Id
left outer join
tnm_stage tnmstage30_
on case1x1_.Working_TNM_Stage_Id=tnmstage30_.Stage_Id
inner join
medikm_resources medikmreso31_
on forumanswe0_.Resource_Id=medikmreso31_.Resourse_Id
inner join
disease_type diseasetyp32_
on medikmreso31_.DiseaseType=diseasetyp32_.Disease_Type_Id
left outer join
physician physician33_
on medikmreso31_.Provider_ID=physician33_.Physician_Id
where
forumanswe0_.Answere_Id=?
Try to add fetch = FetchType.EAGER to your #ManyToOne annotation.
I got similar error about week ago. It helped.
#JoinColumn(name = "ForumQuestionId", referencedColumnName = "ForumQuestionId")
#ManyToOne(fetch = FetchType.EAGER)
private TbDiscussionForumQuestion forumQuestionId;
Does your code eventually finish or is it an actual infinite loop?
I would try removing session.flush(). Flushing the session forces Hibernate to immediately synchronize everything with the database which could be causing what I presume is a performance issue especially if you have a complicated object graph. When you are doing a read-only transaction this is not necessary. You should not need call it explicitly unless you have a good reason to -- Hibernate does a pretty good job of managing itself.
Related
CASE WHEN on a passed in variable
I'm using Java 11 and Postgres 9.6. I am writing a SQL query that will be included in my Java application and I will pass in values to the variables designated with a: SQL CASE WHEN (:designatorInclude IS NOT NULL) THEN totdl.designator_id IN (:designatorInclude) ELSE ttl.product_code IS NOT NULL END Java String filterProductCodes = IOUtil.readResourceText(MyService.class, "sql_files/FilterProductCodes.sql"); Query filterProductCodesQuery = this.em.createNativeQuery(filterProductCodes) if(inDto.getIdList() != null) { filterProductCodesQuery.setParameter("designatorInclude", inDto.getIdList); }else{ filterProductCodesQuery.setParameter("designatorInclude", null); } Passing variables in like this works in many other places in the application. The difference here is that I'm using a CASE/WHERE statement. Everything compiles fine, but when I try to hit this part of the code, I get the following error: PSQLException: ERROR: argument of CASE/WHEN must be type boolean, not type record I found 1 post on the internet about this and it did not apply to my situation. Can anyone shed some light on this? Any suggestions on how I can get this to work? Full SQL - case statement is towards the end. SELECT DISTINCT ttl.product_code, si.condition, totdl.designator_id, ttl.active as ttl_active, l.active as l_active, ii.mls_order_id, ii.damaged, ttl.id as ttl_id, ll.location_id as ll_locationId, cl.location_id as cl_locationId FROM serial_item si JOIN inventory_item ii ON ii.id = si.id AND ii.mls_order_id IS NULL AND ii.damaged = false JOIN title ttl ON ttl.id = si.title_id AND ttl.active = true JOIN public.title_owner_title_designator_lookup totdl ON ttl.id = totdl.title_id JOIN locator l ON l.id = ii.locator_id AND l.active = true LEFT JOIN location_locator ll ON ll.id = l.id AND ll.status IN ('Shelf', 'Intake', 'Donation', 'Wholesaler') LEFT JOIN course_locator cl ON cl.id = l.id WHERE COALESCE(ll.location_id, cl.location_id) = :locationId AND ll.do_not_list_on_markets = false AND CASE WHEN (:designatorInclude IS NOT NULL) THEN totdl.designator_id IN (:designatorInclude) ELSE ttl.product_code IS NOT NULL END
I got this to work by changing my IS NOT NULL check to a COALESCE CASE WHEN **(COALESCE(:include, 0) != 0)** THEN totdl.designator_id IN (:include) ELSE ttl.product_code IS NOT NULL
If I would you, I would select just row column such SELECT ttl.product_code, totdl.designator_id FROM ... I mapped this query normal to an Bean or Entity. And an transient getter could solve your problem.
How can I look at the SQL query really used by myBatis?
The query, created by myBatis, falls with the cause ORA-00933, "SQL command not properly ended". All advice that I found on the net, says that there is some error in the SQL syntax. On the other hand, if I make the SQL by hand, Oracle SQL developer takes it as a correct one. Obviously, I am making it by hand differently that myBatis does. And I need to check it. But how can I check the SQL query really sent by myBatis to the DB? The MyBatis version used: 3.0 I am interested much more in the possibility to look for problems myself than to look for help with every problem. But some people here think that the question must contain the code, so here it is. (mapper.xml) <sql id="pracovisteSql"> /* pozor, pracuje pouze do max 3 vrstev v cis_pracovist */ cis_pracoviste A join cis_pracoviste B on (A.stupen_rizeni in (0,1) and B.kod_nadrizeneho = A.kod_pracoviste) or (A.stupen_rizeni = 2 and A.kod_pracoviste = B.kod_pracoviste) join cis_pracoviste C on (B.stupen_rizeni = 1 and C.kod_nadrizeneho = B.kod_pracoviste) or (B.stupen_rizeni = 2 and C.kod_pracoviste = B.kod_pracoviste) </sql> <sql id="organizaceSql"> WITH organizace AS ( SELECT a.kod_pracoviste as AKP, a.nazev as ANZ, a.stupen_rizeni as AST, a.kod_nadrizeneho as ANR, b.kod_pracoviste as BKP, b.nazev as BNZ, b.stupen_rizeni as BST, b.kod_nadrizeneho as BNR, c.kod_pracoviste as CKP, c.nazev as CNZ, c.stupen_rizeni as CST, c.kod_nadrizeneho as CNR from <include refid="pracovisteSql"/> ) </sql> <sql id="zahajeniOdDo"> (r01.dat_zahajeni between to_date(#{mesicRokOd}, 'MMYYYY') and to_date(#{mesicRokDo, 'MMYYYY')) </sql> <select id="getReportSR02Sql1" parameterType="amcssz.spr.srv.main.dto.reports.ReportSR02QueryDTO" resultType="amcssz.spr.srv.main.dto.reports.ReportSR02Sql1DTO"> <include refid="organizaceSql"/> SELECT Count(Distinct (r01.id_r01_rizeni)) as pocetVRSP From organizace Left join r01_rizeni r01 on organizace.ckp = r01.kod_pracoviste and r01.je_stornovano = 0 and <include refid="zahajeniOdDo"/> and r01.kod_skup_rizeni = 'VRSP' /* r01.kod_rizeni in ('VRSPUC', 'VRSPSR', 'VRSPPE', 'VRSPJI') */ Join r02_stavrizeni r02 on R01.ID_R01_RIZENI = R02.ID_R01_RIZENI and /* Změna 17.1.2020 */ R02.JE_AKTUALNI = '1' and R02.KOD_STAV_RIZENI != 'STR' Join r08_ukon r08 on R01.ID_R01_RIZENI = R08.ID_R01_RIZENI and /* Změna 17.1.2020 */ R08.KOD_UKON IN ('1','14','23','32') and R08.JE_STORNOVAN = '0' Join d02_obalka d02 on R08.ID_R08_UKON = D02.ID_R08_UKON and d02.dat_doruceni IS NOT NULL Where organizace.AKP = #{kodPracoviste} and r01.kod_skup_rizeni is Not Null Group by r01.kod_skup_rizeni Order by 1; </select>
You can configure your log4j level to show the mybatis logging like log4j.logger.org.mybatis.example=DEBUG Full documentation will be found here
If you use intellij idea, try to add a plugin mybatis-log-plugin.The executed SQL will be output in the console
fetching collection using hibernate stuck cpu
I have a condition in that one question can have multiple answers ,in query, I pass question id to retrieve answers. public List<TbDiscussionForumAnswere> findTbDiscussionForumAnswerebyforumQuestionId(Integer forumQuestionId) { session = sessionFactory.getCurrentSession(); System.out.println("Before"+forumQuestionId); List<TbDiscussionForumAnswere> tbDiscussionForumAnswereList = session .createCriteria(TbDiscussionForumAnswere.class) .add(Restrictions.eq("forumQuestionId.forumQuestionId", forumQuestionId)).list(); System.out.println("AFTER "+forumQuestionId); return TbDiscussionForumAnswereList; } entities are as follow #JoinColumn(name = "ForumQuestionId", referencedColumnName = "ForumQuestionId") #ManyToOne private TbDiscussionForumQuestion forumQuestionId; another is like #Id #GeneratedValue(strategy = GenerationType.IDENTITY) #Basic(optional = false) #Column(name = "ForumQuestionId") private Integer forumQuestionId; below query i get from hibernate when i try to fetch data select forumanswe0_.Answere_Id as Answere_2_91_0_, forumanswe0_.Id as Id1_41_0_, forumanswe0_.Id as Id1_41_1_, forumanswe0_.Answere_Id as Answere_2_41_1_, forumanswe0_.Case_Id as Case_Id3_41_1_, forumanswe0_.Resource_Id as Resource4_41_1_, case1x1_.Case_Id as Case_Id1_8_2_, case1x1_.Age as Age2_8_2_, case1x1_.Atelectasis as Atelecta3_8_2_, case1x1_.BaseLine_CA125 as BaseLine4_8_2_, case1x1_.Brca as Brca5_8_2_, case1x1_.Cancer_Sub_Type_Id as Cancer110_8_2_, case1x1_.Cancer_Type_Id as Cancer111_8_2_, case1x1_.Case_HER2neu_Amplified as Case_HER6_8_2_, case1x1_.Chief_Complaint as Chief_Co7_8_2_, case1x1_.Clinical_Stage as Clinical8_8_2_, case1x1_.Clinical_Staging_Method as Clinical9_8_2_, case1x1_.Closest_Margins as Closest10_8_2_, case1x1_.Date_First_Encounter as Date_Fi11_8_2_, case1x1_.Date_Recurrence as Date_Re12_8_2_, case1x1_.Debulking_Status as Debulki13_8_2_, case1x1_.Deceased_Due_BC as Decease14_8_2_, case1x1_.Disease_Propagation as Disease15_8_2_, case1x1_.disease_sub_type_id as diseas112_8_2_, case1x1_.Disease_Treated as Disease16_8_2_, case1x1_.Disease_type as Diseas113_8_2_, case1x1_.dist as dist17_8_2_, case1x1_.Distant_Mets as Distant18_8_2_, case1x1_.Distant_Mets_Comm as Distant19_8_2_, case1x1_.Dt_Death as Dt_Deat20_8_2_, case1x1_.Duration_Of_Symptoms_Mon as Duratio21_8_2_, case1x1_.ER_Percent as ER_Perc22_8_2_, case1x1_.ER_Status as ER_Stat23_8_2_, case1x1_.Esophageal_C_Staging_Method as Esophag24_8_2_, case1x1_.Esophagectomy_Done as Esophag25_8_2_, case1x1_.Final_TNM_Stage_Id as Final_114_8_2_, case1x1_.functional_status as functi115_8_2_, case1x1_.GYN_Oncologist as GYN_Onc26_8_2_, case1x1_.Genetics as Geneti116_8_2_, case1x1_.Genomics as Genomi117_8_2_, case1x1_.Gleason_Score as Gleason27_8_2_, case1x1_.HER2_Status as HER28_8_2_, case1x1_.HER2_SISH as HER29_8_2_, case1x1_.Histological_Grade as Histolo30_8_2_, case1x1_.ido as ido31_8_2_, case1x1_.Immune_Histochemistry as Immune_32_8_2_, case1x1_.Interval_Debulking_Dt as Interva33_8_2_, case1x1_.Invasion_In_Mediastnum as Invasio34_8_2_, case1x1_.Invasion_Into_Carina as Invasio35_8_2_, case1x1_.Invasion_Into_Esophagus as Invasio36_8_2_, case1x1_.Invasion_Into_Great_Vessels as Invasio37_8_2_, case1x1_.Invasion_Into_Heart as Invasio38_8_2_, case1x1_.Invasion_Into_Rec_Laryngeal_Nerve as Invasio39_8_2_, case1x1_.Invasion_Into_Trachea as Invasio40_8_2_, case1x1_.Invasion_Into_Vertbral_Body as Invasio41_8_2_, case1x1_.Invasion_Of_Adj_Structure as Invasio42_8_2_, case1x1_.Invasion_Of_Chest_Wall as Invasio43_8_2_, case1x1_.Invasion_Of_Diaphragm as Invasio44_8_2_, case1x1_.Invasion_Of_Main_Bronchus as Invasio45_8_2_, case1x1_.Invasion_Of_Pericardium as Invasio46_8_2_, case1x1_.Invasion_Of_Phrenic_Nerve as Invasio47_8_2_, case1x1_.Invasion_Of_Pleura as Invasio48_8_2_, case1x1_.Later as Later49_8_2_, case1x1_.lesion_depth as lesion_50_8_2_, case1x1_.Lymfovascular_Invasion as Lymfova51_8_2_, case1x1_.Margins as Margins52_8_2_, case1x1_.Med_Onc_Physician_Id as Med_On118_8_2_, case1x1_.Menopause_Status as Menopau53_8_2_, case1x1_.met_primary as met_pri54_8_2_, case1x1_.met_primary_site as met_pri55_8_2_, case1x1_.metastasis as metasta56_8_2_, case1x1_.Metastatic as Metasta57_8_2_, case1x1_.mi as mi58_8_2_, case1x1_.mucosal_invasion as mucosal59_8_2_, case1x1_.nd_Primary as nd_Prim60_8_2_, case1x1_.Necrosis_Percent as Necrosi61_8_2_, case1x1_.Necrosis_Present as Necrosi62_8_2_, case1x1_.NeoadjResponse as NeoadjR63_8_2_, case1x1_.nln as nln64_8_2_, case1x1_.No_Fossi as No_Foss65_8_2_, case1x1_.No_Nodes as No_Node66_8_2_, case1x1_.Nodal_Metastases as Nodal_M67_8_2_, case1x1_.nv_inf as nv_inf68_8_2_, case1x1_.nyso as nyso69_8_2_, case1x1_.Obstractive_Pneumonitis as Obstrac70_8_2_, case1x1_.OncDxScore as OncDxSc71_8_2_, case1x1_.other_biomarkers as other_b72_8_2_, case1x1_.Overall_Survival as Overall73_8_2_, case1x1_.PR_Percent as PR_Perc74_8_2_, case1x1_.PR_Status as PR_Stat75_8_2_, case1x1_.pathologist as patholo76_8_2_, case1x1_.Patient_Id as Patien119_8_2_, case1x1_.Plastic_Surgeon_Id as Plasti120_8_2_, case1x1_.Platin_Status as Platin_77_8_2_, case1x1_.pleural_Inv as pleural78_8_2_, case1x1_.Prg_Free_Survival as Prg_Fre79_8_2_, case1x1_.Primary_Diagnosis_Dt as Primary80_8_2_, case1x1_.Rad_Onc_Physician_Id as Rad_On121_8_2_, case1x1_.Reason_Not_Treated as Reason_81_8_2_, case1x1_.Recurrence as Recurre82_8_2_, case1x1_.ref_Physician as ref_Phy83_8_2_, case1x1_.Reference_Institution as Refere122_8_2_, case1x1_.Refering_Physicia_Id as Referi123_8_2_, case1x1_.Residual_Tumor as Residua84_8_2_, case1x1_.Secondary_Debulking_Date as Seconda85_8_2_, case1x1_.Seen_On_Bonescan as Seen_On86_8_2_, case1x1_.Seen_On_CT as Seen_On87_8_2_, case1x1_.Seen_On_MRI as Seen_On88_8_2_, case1x1_.Seen_On_PAT as Seen_On89_8_2_, case1x1_.Seen_On_Thallium_Scan as Seen_On90_8_2_, case1x1_.Seen_On_Xray as Seen_On91_8_2_, case1x1_.Separate_TNode_In_Same_Lobe as Separat92_8_2_, case1x1_.Significance_Comorbities as Signifi93_8_2_, case1x1_.Significance_Risk as Signifi94_8_2_, case1x1_.st_Primary as st_Prim95_8_2_, case1x1_.Surg_Onc_Physician_Id as Surg_O124_8_2_, case1x1_.t_location as t_locat96_8_2_, case1x1_.TNodes_In_Diff_Lobe as TNodes_97_8_2_, case1x1_.t_rupture as t_ruptu98_8_2_, case1x1_.tis_bank as tis_ban99_8_2_, case1x1_.tis_bank_odunsi as tis_ba100_8_2_, case1x1_.tis_bank_pnr as tis_ba101_8_2_, case1x1_.Treatment_Related_Death as Treatm102_8_2_, case1x1_.Tumor_Depth as Tumor_103_8_2_, case1x1_.Tumor_Size as Tumor_104_8_2_, case1x1_.tumor_type as tumor_105_8_2_, case1x1_.Unrelated_Death as Unrela106_8_2_, case1x1_.version as versio107_8_2_, case1x1_.WHO_Classification as WHO_Cl108_8_2_, case1x1_.Working_TNM_Stage_Id as Workin125_8_2_, case1x1_.wt as wt109_8_2_, cancersubt2_.Can_Sub_Type_Id as Can_Sub_1_5_3_, cancersubt2_.Cancer_Type_Id as Cancer_T3_5_3_, cancersubt2_.Name as Name2_5_3_, cancertype3_.Can_Type_Id as Can_Type1_6_4_, cancertype3_.CName as CName2_6_4_, cancertype3_.Comments as Comments3_6_4_, cancertype3_.disease_sub_type_id as disease_4_6_4_, cancertype3_.disease_type_Id as disease_5_6_4_, diseasesub4_.Disease_Sub_Type_Id as Disease_1_24_5_, diseasesub4_.Creation_Time as Creation2_24_5_, diseasesub4_.Disease_Sub_Name as Disease_3_24_5_, diseasesub4_.Disease_Type_Id as Disease_5_24_5_, diseasesub4_.Modifcation_Time as Modifcat4_24_5_, diseasetyp5_.Disease_Type_Id as Disease_1_25_6_, diseasetyp5_.Disease_Name as Disease_2_25_6_, diseasetyp6_.Disease_Type_Id as Disease_1_25_7_, diseasetyp6_.Disease_Name as Disease_2_25_7_, cancertype7_.Can_Type_Id as Can_Type1_6_8_, cancertype7_.CName as CName2_6_8_, cancertype7_.Comments as Comments3_6_8_, cancertype7_.disease_sub_type_id as disease_4_6_8_, cancertype7_.disease_type_Id as disease_5_6_8_, diseasesub8_.Disease_Sub_Type_Id as Disease_1_24_9_, diseasesub8_.Creation_Time as Creation2_24_9_, diseasesub8_.Disease_Sub_Name as Disease_3_24_9_, diseasesub8_.Disease_Type_Id as Disease_5_24_9_, diseasesub8_.Modifcation_Time as Modifcat4_24_9_, diseasetyp9_.Disease_Type_Id as Disease_1_25_10_, diseasetyp9_.Disease_Name as Disease_2_25_10_, tnmstage10_.Stage_Id as Stage_Id1_95_11_, tnmstage10_.Value as Value2_95_11_, functional11_.Id as Id1_43_12_, functional11_.Status as Status2_43_12_, genetics12_.Id as Id1_45_13_, genetics12_.GnName as GnName2_45_13_, gemonics13_.Id as Id1_44_14_, gemonics13_.GName as GName2_44_14_, physician14_.Physician_Id as Physicia1_59_15_, physician14_.Cancer_Type_Id as Cancer_T9_59_15_, physician14_.Disease_Type_Id as Disease10_59_15_, physician14_.EMailId as EMailId2_59_15_, physician14_.Facility_Id as Facilit11_59_15_, physician14_.FNAME as FNAME3_59_15_, physician14_.LNAME as LNAME4_59_15_, physician14_.MINIT as MINIT5_59_15_, physician14_.PhoneNo as PhoneNo6_59_15_, physician14_.Phy_Group as Phy_Grou7_59_15_, physician14_.Profile_Image as Profile_8_59_15_, physician14_.Specialty as Special12_59_15_, cancertype15_.Can_Type_Id as Can_Type1_6_16_, cancertype15_.CName as CName2_6_16_, cancertype15_.Comments as Comments3_6_16_, cancertype15_.disease_sub_type_id as disease_4_6_16_, cancertype15_.disease_type_Id as disease_5_6_16_, diseasetyp16_.Disease_Type_Id as Disease_1_25_17_, diseasetyp16_.Disease_Name as Disease_2_25_17_, carefacili17_.Facility_Id as Facility1_7_18_, carefacili17_.Center_Type_Id as Center_T7_7_18_, carefacili17_.Facility_Address as Facility2_7_18_, carefacili17_.Facility_City as Facility3_7_18_, carefacili17_.Facility_Name as Facility4_7_18_, carefacili17_.Facility_State as Facility5_7_18_, carefacili17_.Facility_Type_Type as Facility8_7_18_, carefacili17_.Facility_Zip as Facility6_7_18_, carefacili17_.NQMBC_Certiification_Level_Id as NQMBC_Ce9_7_18_, breastcanc18_.Center_type_Id as Center_t1_2_19_, breastcanc18_.Center_Type_Description as Center_T2_2_19_, facilityty19_.Type_Id as Type_Id1_38_20_, facilityty19_.FName as FName2_38_20_, nqmbclevel20_.Level_Id as Level_Id1_51_21_, nqmbclevel20_.LName as LName2_51_21_, physicians21_.Type_Id as Type_Id1_60_22_, physicians21_.Name as Name2_60_22_, patient22_.Patient_Id as Patient_1_55_23_, patient22_.Active as Active2_55_23_, patient22_.Address as Address3_55_23_, patient22_.Birth_Date as Birth_Da4_55_23_, patient22_.Cell_Phone_Number as Cell_Pho5_55_23_, patient22_.City as City6_55_23_, patient22_.Emergency_Contact_Name as Emergenc7_55_23_, patient22_.Emergency_Contact_Phone_Number as Emergenc8_55_23_, patient22_.Employement_Type as Employem9_55_23_, patient22_.Ethnicity as Ethnici10_55_23_, patient22_.FName as FName11_55_23_, patient22_.Functional_Status as Functio24_55_23_, patient22_.Gender as Gender12_55_23_, patient22_.Increase_Risk as Increas13_55_23_, patient22_.Insurance_Name as Insuran14_55_23_, patient22_.LName as LName15_55_23_, patient22_.MName as MName16_55_23_, patient22_.Mammographic_Breast_Density as Mammogr17_55_23_, patient22_.MedRecNo as MedRecN18_55_23_, patient22_.Patient_Concerns as Patient19_55_23_, patient22_.Phone_Number as Phone_N20_55_23_, patient22_.Race as Race25_55_23_, patient22_.Status as Status21_55_23_, patient22_.Work_Phone_Number as Work_Ph22_55_23_, patient22_.zipcode as zipcode23_55_23_, functional23_.Id as Id1_43_24_, functional23_.Status as Status2_43_24_, race24_.Type_Id as Type_Id1_68_25_, race24_.Race as Race2_68_25_, physician25_.Physician_Id as Physicia1_59_26_, physician25_.Cancer_Type_Id as Cancer_T9_59_26_, physician25_.Disease_Type_Id as Disease10_59_26_, physician25_.EMailId as EMailId2_59_26_, physician25_.Facility_Id as Facilit11_59_26_, physician25_.FNAME as FNAME3_59_26_, physician25_.LNAME as LNAME4_59_26_, physician25_.MINIT as MINIT5_59_26_, physician25_.PhoneNo as PhoneNo6_59_26_, physician25_.Phy_Group as Phy_Grou7_59_26_, physician25_.Profile_Image as Profile_8_59_26_, physician25_.Specialty as Special12_59_26_, physician26_.Physician_Id as Physicia1_59_27_, physician26_.Cancer_Type_Id as Cancer_T9_59_27_, physician26_.Disease_Type_Id as Disease10_59_27_, physician26_.EMailId as EMailId2_59_27_, physician26_.Facility_Id as Facilit11_59_27_, physician26_.FNAME as FNAME3_59_27_, physician26_.LNAME as LNAME4_59_27_, physician26_.MINIT as MINIT5_59_27_, physician26_.PhoneNo as PhoneNo6_59_27_, physician26_.Phy_Group as Phy_Grou7_59_27_, physician26_.Profile_Image as Profile_8_59_27_, physician26_.Specialty as Special12_59_27_, carefacili27_.Facility_Id as Facility1_7_28_, carefacili27_.Center_Type_Id as Center_T7_7_28_, carefacili27_.Facility_Address as Facility2_7_28_, carefacili27_.Facility_City as Facility3_7_28_, carefacili27_.Facility_Name as Facility4_7_28_, carefacili27_.Facility_State as Facility5_7_28_, carefacili27_.Facility_Type_Type as Facility8_7_28_, carefacili27_.Facility_Zip as Facility6_7_28_, carefacili27_.NQMBC_Certiification_Level_Id as NQMBC_Ce9_7_28_, physician28_.Physician_Id as Physicia1_59_29_, physician28_.Cancer_Type_Id as Cancer_T9_59_29_, physician28_.Disease_Type_Id as Disease10_59_29_, physician28_.EMailId as EMailId2_59_29_, physician28_.Facility_Id as Facilit11_59_29_, physician28_.FNAME as FNAME3_59_29_, physician28_.LNAME as LNAME4_59_29_, physician28_.MINIT as MINIT5_59_29_, physician28_.PhoneNo as PhoneNo6_59_29_, physician28_.Phy_Group as Phy_Grou7_59_29_, physician28_.Profile_Image as Profile_8_59_29_, physician28_.Specialty as Special12_59_29_, physician29_.Physician_Id as Physicia1_59_30_, physician29_.Cancer_Type_Id as Cancer_T9_59_30_, physician29_.Disease_Type_Id as Disease10_59_30_, physician29_.EMailId as EMailId2_59_30_, physician29_.Facility_Id as Facilit11_59_30_, physician29_.FNAME as FNAME3_59_30_, physician29_.LNAME as LNAME4_59_30_, physician29_.MINIT as MINIT5_59_30_, physician29_.PhoneNo as PhoneNo6_59_30_, physician29_.Phy_Group as Phy_Grou7_59_30_, physician29_.Profile_Image as Profile_8_59_30_, physician29_.Specialty as Special12_59_30_, tnmstage30_.Stage_Id as Stage_Id1_95_31_, tnmstage30_.Value as Value2_95_31_, medikmreso31_.Resourse_Id as Resourse1_49_32_, medikmreso31_.answer_id as answer_i2_49_32_, medikmreso31_.Date_Of_Posted as Date_Of_3_49_32_, medikmreso31_.Description as Descript4_49_32_, medikmreso31_.DiseaseType as Disease14_49_32_, medikmreso31_.Evidence_Level as Evidence5_49_32_, medikmreso31_.External_Url as External6_49_32_, medikmreso31_.File_Name as File_Nam7_49_32_, medikmreso31_.Keywords as Keywords8_49_32_, medikmreso31_.Name as Name9_49_32_, medikmreso31_.Provider_ID as Provide15_49_32_, medikmreso31_.Publication_Year as Publica10_49_32_, medikmreso31_.Source as Source11_49_32_, medikmreso31_.Type as Type12_49_32_, medikmreso31_.Visibility as Visibil13_49_32_, diseasetyp32_.Disease_Type_Id as Disease_1_25_33_, diseasetyp32_.Disease_Name as Disease_2_25_33_, physician33_.Physician_Id as Physicia1_59_34_, physician33_.Cancer_Type_Id as Cancer_T9_59_34_, physician33_.Disease_Type_Id as Disease10_59_34_, physician33_.EMailId as EMailId2_59_34_, physician33_.Facility_Id as Facilit11_59_34_, physician33_.FNAME as FNAME3_59_34_, physician33_.LNAME as LNAME4_59_34_, physician33_.MINIT as MINIT5_59_34_, physician33_.PhoneNo as PhoneNo6_59_34_, physician33_.Phy_Group as Phy_Grou7_59_34_, physician33_.Profile_Image as Profile_8_59_34_, physician33_.Specialty as Special12_59_34_ from forum_answere_resources forumanswe0_ inner join case1 case1x1_ on forumanswe0_.Case_Id=case1x1_.Case_Id left outer join cancer_sub_type cancersubt2_ on case1x1_.Cancer_Sub_Type_Id=cancersubt2_.Can_Sub_Type_Id left outer join cancer_type cancertype3_ on cancersubt2_.Cancer_Type_Id=cancertype3_.Can_Type_Id left outer join disease_sub_type diseasesub4_ on cancertype3_.disease_sub_type_id=diseasesub4_.Disease_Sub_Type_Id left outer join disease_type diseasetyp5_ on diseasesub4_.Disease_Type_Id=diseasetyp5_.Disease_Type_Id left outer join disease_type diseasetyp6_ on cancertype3_.disease_type_Id=diseasetyp6_.Disease_Type_Id left outer join cancer_type cancertype7_ on case1x1_.Cancer_Type_Id=cancertype7_.Can_Type_Id left outer join disease_sub_type diseasesub8_ on case1x1_.disease_sub_type_id=diseasesub8_.Disease_Sub_Type_Id inner join disease_type diseasetyp9_ on case1x1_.Disease_type=diseasetyp9_.Disease_Type_Id left outer join tnm_stage tnmstage10_ on case1x1_.Final_TNM_Stage_Id=tnmstage10_.Stage_Id left outer join functionalstatus functional11_ on case1x1_.functional_status=functional11_.Id left outer join genetics genetics12_ on case1x1_.Genetics=genetics12_.Id left outer join gemonics gemonics13_ on case1x1_.Genomics=gemonics13_.Id left outer join physician physician14_ on case1x1_.Med_Onc_Physician_Id=physician14_.Physician_Id left outer join cancer_type cancertype15_ on physician14_.Cancer_Type_Id=cancertype15_.Can_Type_Id left outer join disease_type diseasetyp16_ on physician14_.Disease_Type_Id=diseasetyp16_.Disease_Type_Id left outer join care_facility carefacili17_ on physician14_.Facility_Id=carefacili17_.Facility_Id left outer join breast_cancer_center_type breastcanc18_ on carefacili17_.Center_Type_Id=breastcanc18_.Center_type_Id left outer join facility_type facilityty19_ on carefacili17_.Facility_Type_Type=facilityty19_.Type_Id left outer join nqmbc_level nqmbclevel20_ on carefacili17_.NQMBC_Certiification_Level_Id=nqmbclevel20_.Level_Id left outer join physician_speciality physicians21_ on physician14_.Specialty=physicians21_.Type_Id inner join patient patient22_ on case1x1_.Patient_Id=patient22_.Patient_Id left outer join functionalstatus functional23_ on patient22_.Functional_Status=functional23_.Id left outer join race race24_ on patient22_.Race=race24_.Type_Id left outer join physician physician25_ on case1x1_.Plastic_Surgeon_Id=physician25_.Physician_Id left outer join physician physician26_ on case1x1_.Rad_Onc_Physician_Id=physician26_.Physician_Id left outer join care_facility carefacili27_ on case1x1_.Reference_Institution=carefacili27_.Facility_Id left outer join physician physician28_ on case1x1_.Refering_Physicia_Id=physician28_.Physician_Id left outer join physician physician29_ on case1x1_.Surg_Onc_Physician_Id=physician29_.Physician_Id left outer join tnm_stage tnmstage30_ on case1x1_.Working_TNM_Stage_Id=tnmstage30_.Stage_Id inner join medikm_resources medikmreso31_ on forumanswe0_.Resource_Id=medikmreso31_.Resourse_Id inner join disease_type diseasetyp32_ on medikmreso31_.DiseaseType=diseasetyp32_.Disease_Type_Id left outer join physician physician33_ on medikmreso31_.Provider_ID=physician33_.Physician_Id where forumanswe0_.Answere_Id=?
You need to review the fetch strategy of your entities, particularly those with ManyToOne relationships (check this post) which defaults to EAGER fetch type or specify the fetch type programmatically, for example: List<TbDiscussionForumAnswere> tbDiscussionForumAnswereList = session.createCriteria(TbDiscussionForumAnswere.class) .add(Restrictions.eq("forumQuestionId.forumQuestionId",forumQuestionId)) .setFetchMode("forumQuestionId", FetchMode.LAZY) .list();
How to avoid automatic truncation of GROUP_CONCAT result
I am trying to retrieve a long set of result and in doing so I find that the result data is being truncated automatically. I also noticed that the limit of result(String) is 1024 characters. How can I avoid this to get whole data? I am accessing tables through JDBC, if that matters. Code:- SELECT OLL.EMAIL_ID,COUNT(1) AS TOTAL_ORDERS,OLL.SHIPPING_NAME ,SUM(OFF.UNIT_PRICE*OFF.QUANTITY) AS TOTAL_GMV, MIN(ODD.CREATION_DATE) AS FIRST_PURCHASE,MAX(ODD.CREATION_DATE) AS LAST_PURCHASE,GROUP_CONCAT(OFF.PAYMENT_MODE) AS PAY_MODES, GROUP_CONCAT(OFLL.PRODUCT_ID)AS PRODUCT_IDS,LEFT(GROUP_CONCAT(OFLL.PRODUCT_NAME),2048) AS PRODUCTS,OLL.BRAND_NAME,GROUP_CONCAT(OFF.GCTYPE) AS GCTYPE, OLL.SHIPPING_CITY,OLL.SHIPPING_STATE,GROUP_CONCAT(OFF.UNIT_PRICE-OFF.UNIT_SHIPPING_PRICE) AS PRODUCT_PRICE,GROUP_CONCAT(CEILING(OFF.QUANTITY*OFF.UNIT_PRICE)) AS PRODUCT_GMV,GROUP_CONCAT(OFLL.CHANNEL) AS SALES_CHANNEL FROM ( SELECT COUNT(1), OL.ORDER_ID, OL.EMAIL_ID, OFL.CREATED_BY,OL.SELLER_CITY,OL.SHIPPING_STATE FROM (SELECT CREATION_DATE,ORDER_ID,ORDER_ITEM_SEQ_ID FROM ORDER_DATES WHERE CREATION_DATE BETWEEN '2015-01-30 23:55:00' AND '2015-01-30 23:59:59') OD INNER JOIN ORDER_LOGISTICS OL ON OD.ORDER_ID = OL.ORDER_ID AND OD.ORDER_ITEM_SEQ_ID = OL.ORDER_ITEM_SEQ_ID INNER JOIN ORDER_FINANCE OF ON OL.ORDER_ID = OF.ORDER_ID AND OL.ORDER_ITEM_SEQ_ID = OF.ORDER_ITEM_SEQ_ID INNER JOIN ORDER_FILTERS OFL ON OL.ORDER_ID = OFL.ORDER_ID AND OL.ORDER_ITEM_SEQ_ID = OFL.ORDER_ITEM_SEQ_ID INNER JOIN ORDER_STATUS OS ON OL.ORDER_ID = OS.ORDER_ID AND OL.ORDER_ITEM_SEQ_ID = OS.ORDER_ITEM_SEQ_ID WHERE (OF.PAYMENT_MODE='Cash On Delivery' OR OS.PAYMENT_STATUS='Received')AND (OFL.PRODUCT_ID IN ('B4333897','B5163012','B5654542') OR OF.UNIT_PRICE-OF.UNIT_SHIPPING_PRICE='1.00') AND OFL.CHANNEL IN ('Web Channel', 'Mobile Web Channel') AND OL.EMAIL_ID IS NOT NULL GROUP BY OL.EMAIL_ID) AAA, ORDER_LOGISTICS OLL, ORDER_FILTERS OFLL, ORDER_FINANCE OFF,ORDER_DATES ODD WHERE AAA.EMAIL_ID=OLL.EMAIL_ID AND OLL.ORDER_ID=OFLL.ORDER_ID AND OLL.ORDER_ITEM_SEQ_ID=OFLL.ORDER_ITEM_SEQ_ID AND (OFLL.PRODUCT_ID IN ('B4333897','B5163012','B5654542') OR OFF.UNIT_PRICE-OFF.UNIT_SHIPPING_PRICE='1.00') AND OFLL.ORDER_ID=ODD.ORDER_ID AND OFF.ORDER_ID=OLL.ORDER_ID AND OFF.ORDER_ITEM_SEQ_ID=OLL.ORDER_ITEM_SEQ_ID GROUP BY OLL.EMAIL_ID Since I am using GROUP_CONCAT(), the result comes out to be lengthy and that's where it gets truncated.
Why is my HQL query eager loading lazy associations?
I'm trying to improve performance of my HQL query, and I'm stumped. My OneToOne associations on the Adjuster, ZipCode, and EagleUsers objects are all marked as FetchType.LAZY, but nonetheless they're getting immediately pulled from the database when I use this query. session.createQuery( "FROM Adjuster a, ZipCode z, EagleUsers e WHERE a.eagleUsersByUserId = e.userId AND a.adjusterContact.zipCode = z.zip AND a.active = true AND a.isRecordDeleted = false" ).setMaxResults(1).list(); Why is it doing that? SQL Output: Hibernate: select top 1 adjuster0_.AdjusterId as Adjuster1_2_0_, zipcode1_.ZipId as ZipId1_163_1_, eagleusers2_.UserId as UserId1_91_2_, adjuster0_.Active as Active2_2_0_, adjuster0_.AutoAssign as AutoAssi3_2_0_, adjuster0_.SupervisorId as Supervis6_2_0_, adjuster0_.UserId as UserId7_2_0_, adjuster0_.IsRecordDeleted as IsRecord4_2_0_, adjuster0_.IsW2 as IsW5_2_0_, zipcode1_.Areacode as Areacode2_163_1_, zipcode1_.City as City3_163_1_, zipcode1_.County as County4_163_1_, zipcode1_.DST as DST5_163_1_, zipcode1_.Latitude as Latitude6_163_1_, zipcode1_.Longitude as Longitud7_163_1_, zipcode1_.State as State8_163_1_, zipcode1_.Timezone as Timezone9_163_1_, zipcode1_.TimezoneOffset as Timezon10_163_1_, zipcode1_.Zip as Zip11_163_1_, eagleusers2_.FirstName as FirstNam2_91_2_, eagleusers2_.IsRecordDeleted as IsRecord3_91_2_, eagleusers2_.LastName as LastName4_91_2_, eagleusers2_.SubRoleId as SubRoleI5_91_2_ from eagle_prd.dbo.Adjuster adjuster0_ cross join eagle_prd.dbo.ZipCode zipcode1_ cross join eagle_prd.dbo.EagleUsers eagleusers2_ cross join eagle_prd.dbo.AdjusterContact adjusterco3_ where adjuster0_.AdjusterId=adjusterco3_.AdjusterId and adjuster0_.UserId=eagleusers2_.UserId and adjusterco3_.ZipCode=zipcode1_.Zip and adjuster0_.Active=1 and adjuster0_.IsRecordDeleted=0 Hibernate: select adjusterau0_.AdjusterId as Adjuster1_3_0_, adjusterau0_.CurrentWorkZipCode as CurrentW2_3_0_, adjusterau0_.ExcludeHomeZip as ExcludeH3_3_0_, adjusterau0_.HomeZipCode1 as HomeZipC4_3_0_, adjusterau0_.HomeZipCode2 as HomeZipC5_3_0_, adjusterau0_.IsRecordDeleted as IsRecord6_3_0_, adjusterau0_.MaxOneDayClaims as MaxOneDa7_3_0_, adjusterau0_.MaxOneWeekClaims as MaxOneWe8_3_0_, adjusterau0_.MaxTwoDayClaims as MaxTwoDa9_3_0_, adjusterau0_.VacationEnd as Vacatio10_3_0_, adjusterau0_.VacationStart as Vacatio11_3_0_, adjusterau0_.WebAssignments as WebAssi12_3_0_ from eagle_prd.dbo.AdjusterAutoAssign adjusterau0_ where adjusterau0_.AdjusterId=? Hibernate: select adjusterco0_.AdjusterId as Adjuster1_7_0_, adjusterco0_.CarAllowance as CarAllow2_7_0_, adjusterco0_.IsRecordDeleted as IsRecord3_7_0_, adjusterco0_.PhoneAllowance as PhoneAll4_7_0_, adjusterco0_.PhotoPercentage as PhotoPer5_7_0_, adjusterco0_.SeviceFeePercentage as SeviceFe6_7_0_ from eagle_prd.dbo.AdjusterCompensation adjusterco0_ where adjusterco0_.AdjusterId=? Hibernate: select adjusterco0_.AdjusterId as Adjuster1_8_0_, adjusterco0_.City as City2_8_0_, adjusterco0_.Fax as Fax3_8_0_, adjusterco0_.IsRecordDeleted as IsRecord4_8_0_, adjusterco0_.Mobile as Mobile5_8_0_, adjusterco0_.Phone as Phone6_8_0_, adjusterco0_.PhoneExt as PhoneExt7_8_0_, adjusterco0_.State as State8_8_0_, adjusterco0_.Street1 as Street9_8_0_, adjusterco0_.Street2 as Street10_8_0_, adjusterco0_.ZipCode as ZipCode11_8_0_ from eagle_prd.dbo.AdjusterContact adjusterco0_ where adjusterco0_.AdjusterId=? Hibernate: select aspnetuser0_.UserId as UserId1_171_0_, aspnetuser0_.ApplicationId as Applicat7_171_0_, aspnetuser0_.IsAnonymous as IsAnonym2_171_0_, aspnetuser0_.LastActivityDate as LastActi3_171_0_, aspnetuser0_.LoweredUserName as LoweredU4_171_0_, aspnetuser0_.MobileAlias as MobileAl5_171_0_, aspnetuser0_.UserName as UserName6_171_0_ from eagle_prd.dbo.aspnet_Users aspnetuser0_ where aspnetuser0_.UserId=? Hibernate: select aspnetmemb0_.UserId as UserId1_167_0_, aspnetmemb0_.ApplicationId as Applica21_167_0_, aspnetmemb0_.Comment as Comment2_167_0_, aspnetmemb0_.CreateDate as CreateDa3_167_0_, aspnetmemb0_.Email as Email4_167_0_, aspnetmemb0_.FailedPasswordAnswerAttemptCount as FailedPa5_167_0_, aspnetmemb0_.FailedPasswordAnswerAttemptWindowStart as FailedPa6_167_0_, aspnetmemb0_.FailedPasswordAttemptCount as FailedPa7_167_0_, aspnetmemb0_.FailedPasswordAttemptWindowStart as FailedPa8_167_0_, aspnetmemb0_.IsApproved as IsApprov9_167_0_, aspnetmemb0_.IsLockedOut as IsLocke10_167_0_, aspnetmemb0_.LastLockoutDate as LastLoc11_167_0_, aspnetmemb0_.LastLoginDate as LastLog12_167_0_, aspnetmemb0_.LastPasswordChangedDate as LastPas13_167_0_, aspnetmemb0_.LoweredEmail as Lowered14_167_0_, aspnetmemb0_.MobilePIN as MobileP15_167_0_, aspnetmemb0_.Password as Passwor16_167_0_, aspnetmemb0_.PasswordAnswer as Passwor17_167_0_, aspnetmemb0_.PasswordFormat as Passwor18_167_0_, aspnetmemb0_.PasswordQuestion as Passwor19_167_0_, aspnetmemb0_.PasswordSalt as Passwor20_167_0_ from eagle_prd.dbo.aspnet_Membership aspnetmemb0_ where aspnetmemb0_.UserId=? Hibernate: select aspnetprof0_.UserId as UserId1_168_0_, aspnetprof0_.LastUpdatedDate as LastUpda2_168_0_, aspnetprof0_.PropertyNames as Property3_168_0_, aspnetprof0_.PropertyValuesBinary as Property4_168_0_, aspnetprof0_.PropertyValuesString as Property5_168_0_ from eagle_prd.dbo.aspnet_Profile aspnetprof0_ where aspnetprof0_.UserId=? Hibernate: select eagleuseri0_.UserId as UserId1_90_0_, eagleuseri0_.MobilePhone as MobilePh2_90_0_, eagleuseri0_.OfficePhone as OfficePh3_90_0_ from eagle_prd.dbo.EagleUserInfo eagleuseri0_ where eagleuseri0_.UserId=?
The hibernate Query.list() function fetches the complete object, including it's references as it creates a list that is detached from the hibernate scope.