Hello list,
I have some rather disturbing issues when reading a stored shoppingcart object from the database. First of all, here is the entity definition: <entity entity-name="ShoppingSession" package-name="de.comp.order" title="Shopping Session Store"> <field name="userLoginId" type="id-vlong-ne"></field> <field name="shoppingSession" type="blob"></field> <field name="isValid" type="indicator"></field> <prim-key field="userLoginId"/> <relation type="one" rel-entity-name="UserLogin"> <key-map field-name="userLoginId"/> </relation> </entity> As you can see, I'm storing the shoppingcart as a blob. Here's how I write the object to the database: ... shoppingSession.set("shoppingSession", UtilObject.getBytes(cart)); shoppingSession.set("isValid", "Y"); delegator.createOrStore(shoppingSession); Next, I try to read the shoppingcart from the database: ShoppingCart savedCart = (ShoppingCart) shoppingSession.get( "shoppingSession"); On my windows development machine everything works fine. The shoppingcart object is created properly and everybody's happy :-) On my linux server machine on the other hand the above line throws a ClassCastException saying that it cannot cast a SerialBlob to a ShoppingCart. I did a bit of research and found something that confused me. In the getValue() method in SqlJdbcUtil there's a call to deserializeField() on line 576. The call in.readObject() in line 683 in this method returns a WebShoppingCart on my development machine, but it returns null on my server. What is happening here? Any help is greatly appreciated. Cheers, Daniel Daniel Rosowski Consultant AEW Agrenon GmbH Johanniskirchplatz 6 33615 Bielefeld Deutschland Fon: +49 521 5247-413 Fax: +49 521 5247-250 Mobil: +49 170 381 5757 Company and Management Headquarters: Agrenon GmbH, Johanniskirchplatz 6, 33615 Bielefeld, Deutschland, Fon: +49 521 5247-0, Fax: +49 521 5247-250, www.agrenon.com Court Registration: Amtsgericht Bielefeld HRB 36795 Chief Executive Officer: Dirk Osterkamp ---------------------------------------------------------------------------------------------------- This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation. ---------------------------------------------------------------------------------------------------- Besuchen Sie uns! live@lynx: Releasewechsel SAP BI 7.0 & Produktroadmap SAP 19. Juni 2008 Beginn: 15.00 Uhr Geschäftsstelle Bielefeld |
is there a reason you are not using the store shoppingcart service?
Daniel Rosowski sent the following on 6/11/2008 9:16 AM: > Hello list, > > I have some rather disturbing issues when reading a stored shoppingcart > object from the database. First of all, here is the entity definition: > > <entity entity-name="ShoppingSession" > package-name="de.comp.order" > title="Shopping Session Store"> > <field name="userLoginId" type="id-vlong-ne"></field> > <field name="shoppingSession" type="blob"></field> > <field name="isValid" type="indicator"></field> > <prim-key field="userLoginId"/> > <relation type="one" rel-entity-name="UserLogin"> > <key-map field-name="userLoginId"/> > </relation> > </entity> > > As you can see, I'm storing the shoppingcart as a blob. Here's how I write > the object to the database: > ... > shoppingSession.set("shoppingSession", UtilObject.getBytes(cart)); > shoppingSession.set("isValid", "Y"); > delegator.createOrStore(shoppingSession); > > Next, I try to read the shoppingcart from the database: > ShoppingCart savedCart = (ShoppingCart) shoppingSession.get( > "shoppingSession"); > > On my windows development machine everything works fine. The shoppingcart > object is created properly and everybody's happy :-) > On my linux server machine on the other hand the above line throws a > ClassCastException saying that it cannot cast a SerialBlob to a > ShoppingCart. > > I did a bit of research and found something that confused me. In the > getValue() method in SqlJdbcUtil there's a call to deserializeField() on > line 576. The call in.readObject() in line 683 in this method returns a > WebShoppingCart on my development machine, but it returns null on my > server. What is happening here? Any help is greatly appreciated. > > Cheers, > Daniel > > > Daniel Rosowski > Consultant AEW > Agrenon GmbH > Johanniskirchplatz 6 > 33615 Bielefeld > Deutschland > Fon: +49 521 5247-413 > Fax: +49 521 5247-250 > Mobil: +49 170 381 5757 > > > Company and Management Headquarters: > Agrenon GmbH, Johanniskirchplatz 6, 33615 Bielefeld, Deutschland, Fon: +49 521 5247-0, Fax: +49 521 5247-250, www.agrenon.com > > Court Registration: Amtsgericht Bielefeld HRB 36795 > Chief Executive Officer: Dirk Osterkamp > > ---------------------------------------------------------------------------------------------------- > This e-mail may contain trade secrets or privileged, undisclosed, or otherwise confidential information. If you have received this e-mail in error, you are hereby notified that any review, copying, or distribution of it is strictly prohibited. Please inform us immediately and destroy the original transmittal. Thank you for your cooperation. > ---------------------------------------------------------------------------------------------------- > > > Besuchen Sie uns! > > live@lynx: > Releasewechsel SAP BI 7.0 & > Produktroadmap SAP > > 19. Juni 2008 > Beginn: 15.00 Uhr > Geschäftsstelle Bielefeld |
Free forum by Nabble | Edit this page |