I have a custom class called Vendor. When a vendor logs in to my web app, I retrieve an instance of the Vendor class for that Vendor. I want to store the instance in the Session so I don't have to query the datbase repeatedly, and also so I don't have to store multiple Sesion variable for all the properties of the Vendor class.
Storing the Vendor class in session (in the following way) doesn't seem to be a problem (at least no errors arre thrown)
Vendor TempVendor = new Vendor();
TempVendor.Name = "Some Vendor Name";
Retrieving the Vendor instance in it's proper form IS the problem. I receive a ClassCastException when attempting the following:
Vendor TempVendor = (Vendor)session.getAttribute("VendorObject");
I've also tried casting it to an Object, and then to Vendor with the same results:
Object O = session.getAttribute("VendorObject");
Vendor TempVendor = (Vendor)O;
Any help would be greatly appreciated. 500 PTS.