Barberstown, Straffan, Co. Kildare, Ireland.
Tel: +353-1-6012050 Fax: +353-1-6012051
Mobile: +353-86-2157900
www.codefoundry.com
-----Original Message-----
From: A mailing list for Enterprise JavaBeans development [mailto:[EMAIL PROTECTED]] On Behalf Of Kirill Mikhailov
Sent: Friday, June 28, 2002 7:26 AM
To: [EMAIL PROTECTED]
Subject: Large query results threating in SessionBeanHi,
My application works with oil&gas wells production data.
I have a SessionBean with couple of methods which queries very large RDBMS tables (up to 6-7 million records)
and get large results in custom serializable object (20 columns * 12 monthes * 10 year * thousand wells * tens layer * prod. methods... records * number of app. users). The result should be shown to the client as JTable and then saved to file in specified format (csv, excel, etc) on demand.I. It is too expensive to hold the all contents of result in memory of EJB container before return it to the client, so I see only three ways to solve the problem:
1. StateFull SessionBean methods return partial result, for example for every N records, next call to method return next portion of data, but
I don't know how to avoid passivation of the statefull bean. When it will be passivated, I should close the JDBC connection, so ResultSet object will broke
and throw an exception.
2. Using JMS Queue
Session bean method execute query, getting data from ResultSet and periodically sending result object to queue.
Clients are listen for this queue and getting the result. It's seems complicated isn't it? How to restrict the clients receivers to get exactly what they requested?I am afraid that all of the clients which listen to this queue, no matter what they requested in SessionBean will get large objects and overload the LAN.
Only today, I read about message selector when creating Message or QueueReceiver. Does it means when I sending the Message from the SessionBean, it sends only the message header (messageSelector) to all QueueReceivers and then send message body if exists the QueueReceiver for this messageSelector?
3. Using RowSet at the client
I am assuming RowSet class is just extended ResultSet class with Serialization. I guess it is holding connection to RDBMS or SessionBeanwhile its open, but I don't like this way just because I don't wonna make my client thick! That SessionBean doing calculations on every record, which I prefer to do on the server.
II. It is too expensive to hold all result in memory on the client and I'm going to do the TableModel class holding result data pageable to disk. So
MyTableModel.add() method will write data to file and getValueAt(x, y) will get data from buffer. May be you know another way?
Any ideas appreciated! :)
Thanx,
Kirill Mikhailov
