您的位置:程序门 -> java -> j2ee / ejb / jms



用cmp 的 findall 方法提取大数据量时报错,难道不能这么用吗?


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


用cmp 的 findall 方法提取大数据量时报错,难道不能这么用吗?[已结贴,结贴人:lqgscp]
发表于:2007-01-17 16:10:48 楼主
这是sessionbean   中的方法:

    public   transinfodto[]   getalltransinfo()   {
        collection   coll   =   null;
        arraylist   array   =   new   arraylist();
        transinfodto   dto   =   new   transinfodto();

//         timestamp   time   =   new   timestamp(2);
        try   {
            coll   =   transinfohome.findalltransinfo();
            iterator   i   =   coll.iterator();
            while   (i.hasnext())   {
                transinforemote   ejb   =   (transinforemote)   i.next();
                string   linename   =   getlinename(ejb.getsubstaid(),ejb.getlineid());
                        dto   =   new   transinfodto(ejb.getsubstaid()
                                                                      ,   ejb.getlineid()
                                                                      ,   ejb.gettransid()
                                                                      ,   ejb.getstatusflag()
                                                                      ,   ejb.getnousedate()
                                                                      ,   ejb.getnousedays()
                                                                      ,   ejb.getcharcomid()
                                                                      ,   ejb.getusedate()
                                                                      ,   ejb.gettranstypeid()
                                                                      ,   ejb.getusetype()
                                                                      ,   ejb.gettranscapa()

                                                                      ,   ejb.getvoltagein()
                                                                      ,   ejb.getoiltype(),
                                                                      ejb.gettransname(),   ejb.getcopyerid(),
                                                                      ejb.getfeeerid(),

                                                                      ejb.getbooknum(),   ejb.gettransaddr(),
                                                                      ejb.getproducecompany(),   ejb.getproducecode(),
                                                                      ejb.getproducedate(),

                                                                      ejb.getsparefield1(),   ejb.getsparefield2(),
                                                                      ejb.getcompoint(),linename,ejb.getrating()
                        );   //dto   =new     transinfodto   end

                array.add(dto);
            }
        }
        catch   (remoteexception   ex)   {
            ex.printstacktrace();
        }
        catch   (finderexception   ex)   {
            ex.printstacktrace();
        }
        return   (transinfodto[])   array.toarray(new   transinfodto[0]);
    }


这是用   jbuilder2005   自已生成的测试客户端:


        public   static   void   main(string[]   args)   {
        dyxxsesstestclient1   client   =   new   dyxxsesstestclient1();
        dyxxsess   test=client.create();
            try   {
                transinfodto[]   dto   =   test.getalltransinfo();
                system.out.println(dto.length);
            }
            catch   (namingexception   ex)   {
            }
            catch   (remoteexception   ex)   {
            }
    }
发表于:2007-01-18 12:22:461楼 得分:0
我这帖咋这么不香啊,两天了,连个人看都没有,帮顶也行啊,反正不会白来啊
发表于:2007-01-18 15:14:192楼 得分:50
你先算一下你的内存有多大,你的jvm可以使用的内存有多大?
你把大量的数据取出来存在list里,你的内存够用吗?

发表于:2007-01-18 15:39:293楼 得分:0
jvm   的内存怎么算啊?
再说了,如果我要用ejb   取出大量数据就没有办法了吗
发表于:2007-01-18 15:44:274楼 得分:0
jvm的内存就是应用服务器的可以使用的内存,

你可以使用分页来取
发表于:2007-01-18 16:15:445楼 得分:0
23   个字段,700   条数据,就这点数据jvm   内存就挂了?也太弱不禁风了吧


快速检索

最新资讯
热门点击