• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Wrapping ResultSet

 
Ranch Hand
Posts: 89
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?
 
Ranch Hand
Posts: 72
Eclipse IDE Firefox Browser Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
declare your ResultSet as transient.
you will have to take care of the restoration work after all the servlet-applet communication.
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


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
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
The longest recorded flight time of a chicken is 13 seconds. But that was done without this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic