-
1. Re: ResultSet - NotSerializableException ??? Please Help!
johnnycannuk Jan 7, 2002 4:30 PM (in response to aweissman)That's because sun.jdbc.odbc.JdbcOdbcResultSet (or any other implementation of ResultSet) does not implement the Serializable interface. You need to use RowSet from JDBC 2.0, which is the serializable version of ResultSet. Better yet, wrapp all the data in a value or state object and return that (making sure of course, that it is serializable).
Mike -
2. Re: ResultSet - NotSerializableException ??? Please Help!
juergenheidak Jan 7, 2002 4:36 PM (in response to aweissman)The communication between a client and an application server goes over RMI (remote method invocation). All objects that should be transmitted from appserver to the client or back need to implement the interface java.io.Serializable.
As you can read from the api documentation the interface java.sql.ResultSet does not extend the mentioned interface and can therefore not be sent using RMI.
As an alternative you can create a value object (an object containing the data from the ResultSet) that implements Serializable and use it as a container to transmit the data from your bean to the client. -
3. Re: ResultSet - NotSerializableException ??? Please Help!
aweissman Jan 7, 2002 4:37 PM (in response to aweissman)thanks guys for the quick response!!!
-
4. Re: ResultSet - NotSerializableException ??? Please Help!
aweissman Jan 7, 2002 5:05 PM (in response to aweissman)Is the CachedRowSet class the preferred way of passing database data from EJB to Servlet?
-
5. Re: ResultSet - NotSerializableException ??? Please Help!
jfifield Jan 7, 2002 6:16 PM (in response to aweissman)Personally, I like to keep jdbc code out of my servlets altogether. I try to keep the database access in the EJB layer and pass value objects back and forth between EJB and servlet using the Value Object pattern described in the J2EE Patterns Catalog.
This is just "My Preferred Way". I'm sure there are others.
Joe -
6. Re: ResultSet - NotSerializableException ??? Please Help!
aweissman Jan 10, 2002 5:20 PM (in response to aweissman)doesn't this involve a big overhead of converting javax.sql.RowSets to a Value Object?
-
7. Re: ResultSet - NotSerializableException ??? Please Help!
davidjencks Jan 10, 2002 9:38 PM (in response to aweissman)Why would converting ResultSet data to a specified value object format be more resource intensive than copying it to a generic RowSet implementation? If you want the data accessible away from the transaction control, you need to copy it somehow to something that isn't connected to the db driver machinery.