读书人

hibernate分页兑现机制

发布时间: 2012-09-05 15:19:34 作者: rapoo

hibernate分页实现机制

hibernate分页实现机制

?

话说上次面试,面试官问我看过hibernate分页源码,我惭愧的说,没看过。。。这几天真好闲就查了一下hibernate的分页机制。也算差不多明白了吧。。呵呵。。

?

?

hibernate主要的实现函数。它是最后的sql语句。主要使用了3层嵌套。

为什么使用3层嵌套,就涉及到oracle的rownum的实现:

1 Oracle executes your query.
2 Oracle fetches the first row and calls it row number 1.
3 Have we gotten past row number meets the criteria? If no, then Oracle discards the row, If yes, then Oracle return the row.
4 Oracle fetches the next row and advances the row number (to 2, and then to 3, and then to 4, and so forth).
5 Go to step 3.?

?

具体的讲解:

?

参考:http://yyjingcai.iteye.com/blog/809773

???????? http://7880.com/info/Article-4545c3c0.html

?

读书人网 >软件架构设计

热点推荐