• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

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.
reply
    Bookmark Topic Watch Topic
  • New Topic