hibernate中只对一张表执行了查找操作,为什么后台执行了很多语句,导致速度非常慢
对staff执行fromselect语句,结果后台输出如下Hibernate:selecttasksforha0_.HANDOVER2asHANDOVER7_1_,tas...
对staff执行from select语句,结果后台输出如下
Hibernate: select tasksforha0_.HANDOVER2 as HANDOVER7_1_, tasksforha0_.TASKID as TASKID1_, tasksforha0_.TASKID as TASKID0_, tasksforha0_.MONEYMAN as MONEYMAN5_0_, tasksforha0_.ESCARID as ESCARID5_0_, tasksforha0_.CHIEFID as CHIEFID5_0_, tasksforha0_.FINGERPRINT3 as FINGERPR5_5_0_, tasksforha0_.FINGERPRINT1 as FINGERPR6_5_0_, tasksforha0_.HANDOVER2 as HANDOVER7_5_0_, tasksforha0_.FINGERPRINT2 as FINGERPR8_5_0_, tasksforha0_.TEAMLEADER as TEAMLEADER5_0_, tasksforha0_.GOLDADMIN as GOLDADMIN5_0_, tasksforha0_.HANDOVER1 as HANDOVER11_5_0_, tasksforha0_.BANKID as BANKID5_0_, tasksforha0_.MONEYMANFINGER as MONEYMA13_5_0_, tasksforha0_.TASKTYPE as TASKTYPE5_0_, tasksforha0_.TASKTIME as TASKTIME5_0_, tasksforha0_.ISCOMPLETED as ISCOMPL16_5_0_, tasksforha0_.ISAPPROVAL as ISAPPROVAL5_0_, tasksforha0_.APPROVETIME as APPROVE18_5_0_, tasksforha0_.ISCONTROLED as ISCONTR19_5_0_, tasksforha0_.INOUTIME as INOUTIME5_0_, tasksforha0_.ISHANDOVER as ISHANDOVER5_0_, tasksforha0_.HANDOVERTIME as HANDOVE22_5_0_, tasksforha0_.OTHER2 as OTHER23_5_0_ from YY.TASK tasksforha0_ where tasksforha0_.HANDOVER2=?
Hibernate: select fingerprin0_.STAFFEID as STAFFEID1_, fingerprin0_.FINGERPRINTID as FINGERPR1_1_, fingerprin0_.FINGERPRINTID as FINGERPR1_0_, fingerprin0_.STAFFEID as STAFFEID2_0_, fingerprin0_.FINGERPRINT as FINGERPR3_2_0_, fingerprin0_.CHECKFINGER as CHECKFIN4_2_0_ from YY.FINGERPRINT fingerprin0_ where fingerprin0_.STAFFEID=?
…………
Hibernate: select banks0_.PAR_BANKID as PAR2_1_, banks0_.BANKID as BANKID1_, banks0_.BANKID as BANKID0_, banks0_.PAR_BANKID as PAR2_0_0_, banks0_.BANKNAME as BANKNAME0_0_, banks0_.BANKADRESS as BANKADRESS0_0_, banks0_.OTHER1 as OTHER5_0_0_, banks0_.OTHER2 as OTHER6_0_0_ from YY.BANK banks0_ where banks0_.PAR_BANKID=?
Hibernate: select tasksforte0_.TEAMLEADER as TEAMLEADER1_, tasksforte0_.TASKID as TASKID1_, tasksforte0_.TASKID as TASKID0_, tasksforte0_.MONEYMAN as MONEYMAN5_0_, tasksforte0_.ESCARID as ESCARID5_0_, tasksforte0_.CHIEFID as CHIEFID5_0_, tasksforte0_.FINGERPRINT3 as FINGERPR5_5_0_, tasksforte0_.FINGERPRINT1 as FINGERPR6_5_0_, tasksforte0_.HANDOVER2 as HANDOVER7_5_0_, tasksforte0_.FINGERPRINT2 as FINGERPR8_5_0_, tasksforte0_.TEAMLEADER as TEAMLEADER5_0_, tasksforte0_.GOLDADMIN as GOLDADMIN5_0_, tasksforte0_.HANDOVER1 as HANDOVER11_5_0_, tasksforte0_.BANKID as BANKID5_0_, tasksforte0_.MONEYMANFINGER as MONEYMA13_5_0_, tasksforte0_.TASKTYPE as TASKTYPE5_0_, tasksforte0_.TASKTIME as TASKTIME5_0_, tasksforte0_.ISCOMPLETED as ISCOMPL16_5_0_, tasksforte0_.ISAPPROVAL as ISAPPROVAL5_0_, tasksforte0_.APPROVETIME as APPROVE18_5_0_, tasksforte0_.ISCONTROLED as ISCONTR19_5_0_, tasksforte0_.INOUTIME as INOUTIME5_0_, tasksforte0_.ISHANDOVER as ISHANDOVER5_0_, tasksforte0_.HANDOVERTIME as HANDOVE22_5_0_, tasksforte0_.OTHER2 as OTHER23_5_0_ from YY.TASK tasksforte0_ where tasksforte0_.TEAMLEADER=?
省略若干语句
这些表都是相关联的,哪位大侠知道原因?
from Staff……
框架是Dwr,staff.hbm.xml是自动生成的,没有动过 展开
Hibernate: select tasksforha0_.HANDOVER2 as HANDOVER7_1_, tasksforha0_.TASKID as TASKID1_, tasksforha0_.TASKID as TASKID0_, tasksforha0_.MONEYMAN as MONEYMAN5_0_, tasksforha0_.ESCARID as ESCARID5_0_, tasksforha0_.CHIEFID as CHIEFID5_0_, tasksforha0_.FINGERPRINT3 as FINGERPR5_5_0_, tasksforha0_.FINGERPRINT1 as FINGERPR6_5_0_, tasksforha0_.HANDOVER2 as HANDOVER7_5_0_, tasksforha0_.FINGERPRINT2 as FINGERPR8_5_0_, tasksforha0_.TEAMLEADER as TEAMLEADER5_0_, tasksforha0_.GOLDADMIN as GOLDADMIN5_0_, tasksforha0_.HANDOVER1 as HANDOVER11_5_0_, tasksforha0_.BANKID as BANKID5_0_, tasksforha0_.MONEYMANFINGER as MONEYMA13_5_0_, tasksforha0_.TASKTYPE as TASKTYPE5_0_, tasksforha0_.TASKTIME as TASKTIME5_0_, tasksforha0_.ISCOMPLETED as ISCOMPL16_5_0_, tasksforha0_.ISAPPROVAL as ISAPPROVAL5_0_, tasksforha0_.APPROVETIME as APPROVE18_5_0_, tasksforha0_.ISCONTROLED as ISCONTR19_5_0_, tasksforha0_.INOUTIME as INOUTIME5_0_, tasksforha0_.ISHANDOVER as ISHANDOVER5_0_, tasksforha0_.HANDOVERTIME as HANDOVE22_5_0_, tasksforha0_.OTHER2 as OTHER23_5_0_ from YY.TASK tasksforha0_ where tasksforha0_.HANDOVER2=?
Hibernate: select fingerprin0_.STAFFEID as STAFFEID1_, fingerprin0_.FINGERPRINTID as FINGERPR1_1_, fingerprin0_.FINGERPRINTID as FINGERPR1_0_, fingerprin0_.STAFFEID as STAFFEID2_0_, fingerprin0_.FINGERPRINT as FINGERPR3_2_0_, fingerprin0_.CHECKFINGER as CHECKFIN4_2_0_ from YY.FINGERPRINT fingerprin0_ where fingerprin0_.STAFFEID=?
…………
Hibernate: select banks0_.PAR_BANKID as PAR2_1_, banks0_.BANKID as BANKID1_, banks0_.BANKID as BANKID0_, banks0_.PAR_BANKID as PAR2_0_0_, banks0_.BANKNAME as BANKNAME0_0_, banks0_.BANKADRESS as BANKADRESS0_0_, banks0_.OTHER1 as OTHER5_0_0_, banks0_.OTHER2 as OTHER6_0_0_ from YY.BANK banks0_ where banks0_.PAR_BANKID=?
Hibernate: select tasksforte0_.TEAMLEADER as TEAMLEADER1_, tasksforte0_.TASKID as TASKID1_, tasksforte0_.TASKID as TASKID0_, tasksforte0_.MONEYMAN as MONEYMAN5_0_, tasksforte0_.ESCARID as ESCARID5_0_, tasksforte0_.CHIEFID as CHIEFID5_0_, tasksforte0_.FINGERPRINT3 as FINGERPR5_5_0_, tasksforte0_.FINGERPRINT1 as FINGERPR6_5_0_, tasksforte0_.HANDOVER2 as HANDOVER7_5_0_, tasksforte0_.FINGERPRINT2 as FINGERPR8_5_0_, tasksforte0_.TEAMLEADER as TEAMLEADER5_0_, tasksforte0_.GOLDADMIN as GOLDADMIN5_0_, tasksforte0_.HANDOVER1 as HANDOVER11_5_0_, tasksforte0_.BANKID as BANKID5_0_, tasksforte0_.MONEYMANFINGER as MONEYMA13_5_0_, tasksforte0_.TASKTYPE as TASKTYPE5_0_, tasksforte0_.TASKTIME as TASKTIME5_0_, tasksforte0_.ISCOMPLETED as ISCOMPL16_5_0_, tasksforte0_.ISAPPROVAL as ISAPPROVAL5_0_, tasksforte0_.APPROVETIME as APPROVE18_5_0_, tasksforte0_.ISCONTROLED as ISCONTR19_5_0_, tasksforte0_.INOUTIME as INOUTIME5_0_, tasksforte0_.ISHANDOVER as ISHANDOVER5_0_, tasksforte0_.HANDOVERTIME as HANDOVE22_5_0_, tasksforte0_.OTHER2 as OTHER23_5_0_ from YY.TASK tasksforte0_ where tasksforte0_.TEAMLEADER=?
省略若干语句
这些表都是相关联的,哪位大侠知道原因?
from Staff……
框架是Dwr,staff.hbm.xml是自动生成的,没有动过 展开
3个回答
展开全部
hbiernate的配制文件有一个show sql是否为true的你把改成false或者去掉都行
追问
这样做是不输出sql语句了,但是查询速度没有提升啊,我是想知道如何才能不执行哪些废语句,其他表的语句我不想执行
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
把有的属性改成延迟加载
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
你可以、、做批量处理、、
追问
何解?具体点儿呗……给个例子也行啊
追答
就是在从加一个betch-size=5
这个数最好在5---8之间、、
这样就可以把很多条语句变成一条了、、
本回答被提问者和网友采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询