| Author |
How to save a Message object as a blob in Oracle database.
|
Akhil gupta
Greenhorn
Joined: Apr 17, 2004
Posts: 2
|
|
Hi I need to save a Message object read from a mailbox as a blob in Oracle database. While doing so I am getting the NotSerializableException, which I understand is because the Message class does not implement the Serializable interface. Can anyone tell me how to save it? I have written the following code:
|
 |
J Kneeland
Ranch Hand
Joined: Aug 15, 2004
Posts: 31
|
|
|
You would have to extract the data and write the data instead of he object.
|
 |
Julian Kennedy
Ranch Hand
Joined: Aug 02, 2004
Posts: 823
|
|
Hi AkhilGupta Gupta, My first reaction was to say "wrap it in something that does" but, on reflection, that may be a little naive. I've not checked a spec or anything but I imagine it may be necessary for all members to be serializable, so that wouldn't help. The other alternative is to define a SerializableMessage class and copy the state of your Message to an instance of it for serialization, then do the reverse after deserialization. Maybe there are more elegant methods, but that's my best attempt. Jules
|
 |
Akhil gupta
Greenhorn
Joined: Apr 17, 2004
Posts: 2
|
|
Thanks Guys Following piece of code has worked for me.
|
 |
Dirk Schreckmann
Sheriff
Joined: Dec 10, 2001
Posts: 7023
|
|
Akhil_gupta01, Welcome to JavaRanch! We ain't got many rules 'round these parts, but we do got one. Please change your display name to comply with The JavaRanch Naming Policy. We request that display names be of the pattern FIRST_NAME + SPACE + LAST_NAME. Thanks Pardner! Hope to see you 'round the Ranch!
|
[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
|
 |
 |
|
|
subject: How to save a Message object as a blob in Oracle database.
|
|
|