Re: Storing serialized object in MySql Database
Re: Storing serialized object in MySql Database
- Subject: Re: Storing serialized object in MySql Database
- From: Jesse Tayler via Webobjects-dev <email@hidden>
- Date: Tue, 11 Aug 2020 15:29:50 -0400
hmmm…what’s your model look like? Or how are you setting up the storage of that
data?
Sounds like you want a string and might watch the encoding of it before storage
—
It sounds perhaps like this error could occur because your data types are
mismatched in a way that results in a validation error that doesn’t sound
helpful or familiar…
Sometimes databases or models have fancy options when really you just need a
string and it’s no big deal and so, you might look that over for sanity...
> On Aug 11, 2020, at 3:17 PM, Don Lindsay <email@hidden> wrote:
>
> Hello;
>
> I am not using JSON here, I certainly could but that is not what the customer
> has requested. They want serialized Java Objects, not Java Script Object
> Notation. Java Serialized objects are byte arrays, much like a stream of
> file contents read from a disk with Reader object.
>
> I have checked all my types and they are fine, I have even tried different
> types (var binary, BLOB, etc) all puke on a byte array.
>
> None of the other columns have an issue, if I comment out
> getSelectedTile().takeStoredValueForKey(Session.<TileStorage>convertObject(new
> TileStorage(this)),"serial”); the object inserts into the EC and save works.
>
> Thanks,
>
> Don
>
>> On Aug 11, 2020, at 09:30, Jesse Tayler <email@hidden> wrote:
>>
>> Well, I’m sure there is validation for JSON since that has issues with
>> format and encodings, so I’d expect some of that sort of thing here.
>>
>> I don’t really see the value or whatever expected type, so I’d find that
>> value that breaks it and test it —
>>
>> One thing I wonder is about text encoding, are you certain you’ve got all
>> your types correct?
>>
>> I mean, it is gaging on a value somewhere, it could be a small as an invalid
>> character or sequence.
>>
>>> On Aug 11, 2020, at 8:26 AM, Don Lindsay <email@hidden> wrote:
>>>
>>> The value entered for <b>Serial</b> is not a valid <b>?</b>.
>>>
>>> ERXVaidationException
>>>
>>> I have setup no Validation, so it must be Wonder or WebObjects base
>>> validation that is throwing the error
>>>
>>>> On Aug 10, 2020, at 18:20, Jesse Tayler <email@hidden> wrote:
>>>>
>>>> Did you list your error?
>>>>
>>>>> On Aug 10, 2020, at 6:08 PM, Don Lindsay via Webobjects-dev
>>>>> <email@hidden> wrote:
>>>>>
>>>>> 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
>>>>
>>>
>>
>
_______________________________________________
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