Storing serialized object in MySql Database
Storing serialized object in MySql Database
- Subject: Storing serialized object in MySql Database
- From: Don Lindsay via Webobjects-dev <email@hidden>
- Date: Mon, 10 Aug 2020 18:08:08 -0400
Hello;
I have an app that the ucxstomer has asked to store specific serialized objects
into a MySQL database. I have stored serialized objects in MySQL many times,
at customer request. I get an error am trying to populate the field with
incorrect data type. The convertObject method is a standard format method for
serializing a java object. It is the same code we use for converting objects
to byte arrays in another application that uses jdbc. The object is able to be
serialized fine, but can’t be put into the column and then saved to the
database by EOF.
The Code:
getSelectedTile().takeStoredValueForKey(Session.<TileStorage>convertObject(new
TileStorage(this)),"serial");
Tile entity :
attributes = (
{columnName = description; name = description; prototypeName = longText; },
{
className = "java.lang.Number";
columnName = id;
externalType = INT;
name = id;
precision = 10;
valueType = l;
},
{columnName = name; name = name; prototypeName = longText; },
{
allowsNull = Y;
className = "com.webobjects.foundation.NSData";
columnName = serial;
externalType = BLOB;
name = serial;
width = 65535;
},
{
allowsNull = Y;
className = "com.webobjects.foundation.NSData";
columnName = tilejson;
externalType = BLOB;
name = tilejson;
width = 65535;
},
{
allowsNull = Y;
className = "com.webobjects.foundation.NSData";
columnName = visualization;
externalType = BLOB;
name = visualization;
width = 65535;
}
);
I have tried to set the classname of the serial field to the class being stored
but that does not work either. I figure if all else fails I can do a RAW SQL
and store the serialized object, but I would prefer that EOF handle all that.
Thanks in advance for any help.
Don
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Webobjects-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden