我只想要一个使用hibernate的数据列表但是通过调用下面的方法我的代码卡在某处并且自动我的CPU使用率变为100%
List<TbDiscussionForumAnswere> tbdAnsList = tbDiscussionForumDao.findTbDiscussionForumAnswerebyforumQuestionId(questionId);
下一个功能是
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();
}
通过调用上面的方法我的代码卡住了,自动cpu使用率高达100%来自实体的代码是
@JoinColumn(name = "ForumQuestionId", referencedColumnName = "ForumQuestionId")
@ManyToOne
private TbDiscussionForumQuestion forumQuestionId;
另一个是
@Column(name = "ForumQuestionId")
private Integer forumQuestionId;
下面是我的休眠日志,但我无法理解
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=?
答案 0 :(得分:0)
尝试将fetch = FetchType.EAGER
添加到@ManyToOne注释中。
一周前我得到了类似的错误。它有所帮助。
@JoinColumn(name = "ForumQuestionId", referencedColumnName = "ForumQuestionId")
@ManyToOne(fetch = FetchType.EAGER)
private TbDiscussionForumQuestion forumQuestionId;
答案 1 :(得分:0)
您的代码最终是完成还是实际无限循环?
我会尝试删除session.flush()
。刷新会话会强制Hibernate立即将所有内容与数据库同步,这可能导致我认为是性能问题,特别是如果您有一个复杂的对象图。当您进行只读事务时,这不是必需的。你不应该明确地调用它,除非你有充分的理由--Hibernate在管理自己方面做得很好。