dcsimg
I am writing a shopping cart with servlet and I am confuse about Serializable
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   guillermo_thompson
Posted On:   Wednesday, December 25, 2002 11:26 PM

my e-mail is Thompsonluque @ hotmail.com I got a java program the implements java.io.Serializable this program is my shopping cart object where I save the orders in hash tables during the session when the session end also the hash table is deleted, this worked fine , But I made a change , I save the object in mysql data base with "psInsert.setObject(1, cart);" where card is "cart = (ShoppingCart) session.getValue ("cart");" when the session end I tried to restore the object from the mysql data base and I got this error; "java.lang.ClassCastException: [B" this error is produced for this code cart = (Shoppin   More>>

my e-mail is Thompsonluque @ hotmail.com
I got a java program the implements java.io.Serializable
this program is my shopping cart object where I save
the orders in hash tables during the session when the
session end also the hash table is deleted, this worked
fine , But I made a change , I save the object
in mysql data base with "psInsert.setObject(1, cart);"
where card is
"cart = (ShoppingCart) session.getValue ("cart");"
when the session end I tried to restore the object
from the mysql data base and I got this error;

"java.lang.ClassCastException: [B"

this error is produced for this code

cart = (ShoppingCart) session.getValue ("cart");
cart = (ShoppingCart) rs.getObject(2); <---- error


just in case the mysql is the field where i stored
shop_blob

CREATE TABLE shoppingcart (
shop_email VARCHAR(50) NOT NULL, /* email address */
shop_blob LONGBLOB NOT NULL,
PRIMARY KEY ( shop_email)
);















Please use html tags to format code blocks.

   <<Less
About | Sitemap | Contact