生成的HQL语句;Hibernate: select * from ( select row_.*, rownum rownum_ from ( select career0_.intID as col_0_0_, c areer0_.intUserId as col_1_0_, career0_.strCareername as col_2_0_, career0_.dtTIME as col_3_0_, care er0_.intCareerId as col_4_0_, career0_.CareerType as col_5_0_, career0_.CareerSalary as col_6_0_, ca reer0_.CareerExpire as col_7_0_, career0_.strSheng as col_8_0_, career0_.strCity as col_9_0_, career 0_.strCompany as col_10_0_, career0_.intCheck as col_11_0_ from hr_career career0_ where career0_.in tClose=1 and career0_.intParentId=0 order by career0_.intID desc ) row_ where rownum <= ?) where row num_ > ?大家看看有没有什么问题?
我直接在oracle上写SQL 执行:时间不超过1秒的SELECT * FROM ( SELECT row_.*, rownum rownum_ FROM (select intid,strusername,intuserid,strcareername,dttime from hr_career where intclose=1 and intparentid =0) row_ WHERE rownum <= 20010) WHERE rownum_ > 20000 为什么显示的速度这么慢 要3-4秒当数据量为10万的时候 显示速度则是很快 不知是什么原因造成的
areer0_.intUserId as col_1_0_, career0_.strCareername as col_2_0_, career0_.dtTIME as col_3_0_, care
er0_.intCareerId as col_4_0_, career0_.CareerType as col_5_0_, career0_.CareerSalary as col_6_0_, ca
reer0_.CareerExpire as col_7_0_, career0_.strSheng as col_8_0_, career0_.strCity as col_9_0_, career
0_.strCompany as col_10_0_, career0_.intCheck as col_11_0_ from hr_career career0_ where career0_.in
tClose=1 and career0_.intParentId=0 order by career0_.intID desc ) row_ where rownum <= ?) where row
num_ > ?大家看看有没有什么问题?
为什么显示的速度这么慢 要3-4秒当数据量为10万的时候 显示速度则是很快 不知是什么原因造成的
Hibernate内核怎么做成的,我不知道,但是大家想一下,大家做AJAX的时候,不用DWR框架,而用自己写的XMLREQUEST做,才不要10行代码,就上XML转化,也觉得不需要DWR这么多东西,和判断,这样明显的例子说明了最肤浅的问题,例如你做一个标签可以通用,可是其中你必须得用到JAVA反射技术和很多判断,这比不用TAG绝对要很多,这点谁都不可否认对于2楼这位朋友
Hibernate的分页查询SQL已经是最优了
提出严重的质疑,Hibernate可以用索引,难道我们自己就不能写索引呢吗?换句话说,Hibernate做的SQL操作和我们写的SQL是一样的,只是它肯定还会比我们多很判断和错误处理。
为什么,做搜索引擎的要自己写操作系统呢??当然,我这是单纯以单纯以速度这点去说这个观点的,大家在做项目的时候完全可以不用MVC模式,对于一下些小项目,相反的采用这些模式,相反的是提高了工作难度和效率。
用框架和组件的同时,我希望大家明白起原理,真不希望一个用了1年后的Hibernate人才连SQL语句都会写