Forums Register Login

Wrapping ResultSet

+Pie Number of slices to send: Send
Hi
Since resultset cannot be serialize because it does'nt implement Serializable interface, is it possible to wrap it in a class that implements Serializable interface. The reason for this question is that I have an applet displaying data in the database, and one way of communicating servlet to applet is through http tunneling and streaming and i have to access the resultset from the servlets. Is is possible?
+Pie Number of slices to send: Send
declare your ResultSet as transient.
you will have to take care of the restoration work after all the servlet-applet communication.
+Pie Number of slices to send: Send
 


Hi
Since resultset cannot be serialize because it does'nt implement Serializable interface, is it possible to wrap it in a class that implements Serializable interface


Wrapping it in an object that is serializable won't help because the object and everything that is a member of that object all the way down the object graph must be serializable.
You need to take the data from the result set and put it into a collection of value objects and then either serialize the entire collection to the client or let the servlet handle the collection and only give you the objects that you need.
Paul
+Pie Number of slices to send: Send
Think you can use the sun.jdbc.rowset.CachedRowset. It is disconnected and serializable.
You can find a jsp example at http://developer.java.sun.com/developer/technicalArticles/javaserverpages/cachedrowset/
Cheers,
Ruud.
For my next feat, I will require a volunteer from the audience! Perhaps this tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1478 times.
Similar Threads
PAGING EJB's and jsp - Urgent help Needed
Resultset
Forwarding resultset from servlet to applet
Serialzation is not working
How to Serialize ResultSet Interface
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 28, 2024 05:36:10.