注册 登录
编程论坛 J2EE论坛

hibernate分页

恋轩念伊人 发布于 2008-10-06 18:32, 3024 次点击
这个是用hibernate+struts做的分页,核心还是在hibernate。
本来想把库文件也发上,不过太大拉,就没有发拉,不知道大家看这些能运行不(大家自己加上库吧,抱歉中。。。)。
15 回复
#2
huwangvs2008-10-07 09:10
hibernate分页基本就是写个plsql就完事了。
还是它的底层分页实现比较有看头
#3
恋轩念伊人2008-10-12 15:04
也算是,不过我 刚开始学的的时候都觉得hibernate很有用,后来被spring搞的好象hibernate是个傀儡一样,真是衰!!!!
#4
lawywxf2008-10-16 10:56
看看,看了就晓得有没有用,呵呵。。。
谢谢!lz
#5
恋轩念伊人2008-10-20 21:16
大家有东西一起分享
#6
Ethip2008-10-20 21:44
留个脚印 haha
#7
流星阿勇2008-10-20 23:10
PL\SQL写的一个分页,跟大家分享。多多指点。
create or replace procedure prefection_page(strSql varchar2,curpage number,pageunit number,ordername varchar2,ordertype number,allrecord out number,records out yong.r_cursor)
as
allSql varchar2(1000);
allrecord_sql varchar2(500);
startpoint number(10);
endpoint number(10);
begin
     if(curpage is not null and pageunit is not null)then
         startpoint:=(curpage-1)*pageunit+1;
         endpoint:=curpage*pageunit;
     end if;
    -- allrecord_sql:='select count(1) from ('||strSql||')';
    -- execute immediate allrecord_sql into allrecord;
    -- get_allrecord(strSql,allrecord);--存储过程调用存储过程
    -- allrecord:=get_fun_allrecord(strSql);--存储过程调用函数
     allrecord:=yong.get_fun_allrecord(strSql);--存储过程调用包中的函数
     
     if(ordername is not null and length(ordername)>0)then
         allSql:=strSql||' order by '||ordername;
         if(ordertype is not null) then
           if(ordertype=1) then
             allSql:=allSql||' asc';
           elsif
             (ordertype=2) then
               allSql:=allSql||' desc';
           end if;
         end if;
     end if;
     allSql:='select B.* from (select A.*,rownum rid from ('||allSql||') A where rownum<='||endpoint||') B where B.rid>='||startpoint;
     open records for allSql;
     
     Exception
      when others then
           dbms_output.put_line('程序运行出错了!');
           raise;
end;
#8
duanchangren2008-10-21 21:31
简单的就是最好的
支持楼上的
#9
恋轩念伊人2008-11-11 16:58
以后发一个spring的不过好像还不会
呵呵!!!
#10
liun52102008-11-11 20:11
不错哦!!
#11
恋轩念伊人2008-11-12 17:57
回复 10# 的帖子
这个回答让我想起周董
1