Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

blob to shoppingcart issue
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  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 otherwi
se confidential information. If you have received this e-mail in error, you 
are hereby notified that any review, copying, or distribution of it is stric
tly prohibited. Please inform us immediately and destroy the original transm
ittal. 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

Report this thread to moderator Post Follow-up to this message
Old Post
Daniel Rosowski
06-12-08 12:57 AM


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




Report this thread to moderator Post Follow-up to this message
Old Post
BJ Freeman
06-12-08 12:57 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

OFBiz archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 12:43 PM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.