That won't work.  I belive it'll error on the methods that are in the
'this' scope.  You can do some looping and typechecking to get around
this, of course, but the real problem resides with nested objects,
because they have to be recursively serialized as well.

In Java, your serializable object gets passed an output stream that it
writes to, usually just delegating to the Object class's
implementation.  Then the serializer (the code doing the serialization
of the object) does whatever it wants with the data (save to file,
write to DB, pass over network, etc.).  Deserialization works in
exactly the reverse fashion.

The other problem you have to contend with is that to deserialize an
object, you need to have access to the class that backs it.  I.e. be
able to instantiate an instance of the class.  Since it's unlikely
that you'll have your application code somewhere else without also
having the database hanging around, it's usually easier to just
persist the object to the DB and then recreate it on the other side. 
The main exception would be for session replication with CFC
instances, of course.

cheers,
barneyb

On Wed, 23 Feb 2005 16:59:50 -0500, S. Isaac Dealey <[EMAIL PROTECTED]> wrote:
> Well you could always do this:
> 
> <cffunction name="serialize">
>         <cfset var wddx = "">
>         <cfwddx action="cfml2wddx" input="#variables#" variable="wddx">
>         <cfreturn wddx>
> </cffunction>
> 
> I've never serialized objects via java myself -- I remember reading
> that they typically get written to files, so maybe the serialize
> function should actually be writing the packet to a file and returning
> true instead. I'd have to go look at the java docs for reference to
> know... But iirc the "this" scope is also included in the variables
> scope for the CFC, so that one cfwddx call should wrap up all your
> data which would let you reinstantiate the serialized component later.
> 
> hth
> 
> s. isaac dealey   954.927.5117
> new epoch : isn't it time for a change?
> 

-- 
Barney Boisvert
[EMAIL PROTECTED]
360.319.6145
http://www.barneyb.com/

Got Gmail? I have 50 invites.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Logware (www.logware.us): a new and convenient web-based time tracking 
application. Start tracking and documenting hours spent on a project or with a 
client with Logware today. Try it for free with a 15 day trial account.
http://www.houseoffusion.com/banners/view.cfm?bannerid=67

Message: http://www.houseoffusion.com/lists.cfm/link=i:4:196254
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54

Reply via email to