关于java中分页的实现

一直以来,分页和排序问题一直是做J2ee项目的一个很重要的问题。一个好的分页排序算法,会使系统得到很好的性能.反之,系统性能会很低,而且系统速度慢,这是每位programmer不想看见的。
总结现在的关于排序分页方面的各种实现,大概有一下几种:
1,基于框架实现的,如hibernate的内部分页排序的实现。
2,基于外部组件的实现,如Toplink比较多,可是没有分页的支持。
3,还有的就是各个项目组自己的实现了。
一直我都希望在自己的项目组内部来实现分页排序,现在把我了解的写下来。
据robbin提到的分页算法,
SELECT * FROM
( SELECT row_.*, rownum rownum_ FROM
(selelct * from TABLE where ..... ) row_
WHERE rownum <= ?
)
WHERE rownum_ > ?

注释:[b]1,首先是最内层,得到你想要的所有数据了。
2,然后利用Oracle内部rownum,为从内部那层搜索到的数据来编号,这样就可以来利用rownum来实现分页了。
3,直接然后自己选择那些已经编号了数据就可以得到任意数据了。[/b]
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
封装通用的Spring3+Struts2+MyBatis3的CRUD+条件分页查询,Spring+Quartz调度,FunctionCharts图像化工具 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"> <bean id="temperMonitorTimerJob" class="cn.sup.cd.listener.TemperatureMonitorTaskJob"></bean> <!-- 政策调度--> <bean id="temperMonitorTask" class="org.springframework.scheduling.quartz.MethodInvokingJobDetailFactoryBean"> <!-- 调用的类 --> <property name="targetObject"> <ref bean="temperMonitorTimerJob"/> </property> <!-- 调用类的方法 --> <property name="targetMethod"> <value>temperatureMonitorTimer</value> </property> </bean> <!-- BOOK定义触发时间 几秒后执行monitor.start.time 每隔monitor.interval.time执行--> <bean id="getPolicyTime" class="org.springframework.scheduling.quartz.CronTriggerBean"> <property name="jobDetail"> <ref bean="temperMonitorTask"/> </property> <!-- cron表达式 --> <property name="cronExpression"> <value>${monitor.start.time}/${monitor.interval.time} * * * * ?</value> </property> </bean> <!-- 总管理类 如果将lazy-init='false'那么容器启动就会执行调度程序 --> <bean id="startQuertz" lazy-init="false" autowire="no" class="org.springframework.scheduling.quartz.SchedulerFactoryBean"> <property name="triggers"> <list> <ref bean="getPolicyTime"/> </list> </property> </bean> </beans>

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值