Re: Saving beans to a databse

2009-02-18 Thread Mike Kear

If you're using the Rooibos bean, then there's a getsnapshot() or
getMemento() method that gives a struct containing all the current
values.  (to see what's in it,   then do this;

cfdump var=#beanname.getsnapshot()# /  and you'll see the current
state of the bean.You can serialise this using wddx  which makes
that struct into a XML packet you can put in a text field.   Then you
can get it back again by reading it out of the database and turning it
back into a struct with WDDX2CF() function.

Or what's much better, quicker and neater,  is you can persist the
bean into the database using a  DAO's save() method and get it back
again next time your user logs in using the DAO's read() method.  (For
an example of what's in my DAOs see the tutorial on my site at
http://afpwebworks.com/Index.cfm?pid=111419 )


Cheers
Mike Kear
Windsor, NSW, Australia
Adobe Certified Advanced ColdFusion Developer
AFP Webworks
http://afpwebworks.com
ColdFusion, PHP, ASP, ASP.NET hosting from AUD$15/month



On Wed, Feb 18, 2009 at 6:13 PM, David Mineer min...@gmail.com wrote:

 I have a siteoptions bean which holds session variables that are unique to
 each user.  I use roobies cfc bean generator to create a bean which gives me
 get and set access to variables which essetially match the form on my
 website that I use to collect the information.

 How can I store this information in the database to persist it between
 visits for my users?

 The obvious answer would be to have a matching table in the database which
 has a corresponding field for each form field.  I could use transfer for
 this and it would work great and I understand that.  But would that be a
 good thing?

 Or is there I way I can take the bean and just save it to the database as
 one object, easily retrievable for the next session.

 I guess now that I think about it, either way I will have to have a db
 table, so there goes that advantage.  But if the bean were to grow or change
 The db wouldn't have to if I was able to save the whole object.

 Anyone have any thoughts on these ramblings?

 --
 David Mineer Jr
 -
 The critical ingredient is getting off your
 butt and doing something. It's as simple
 as that. A lot of people have ideas, but
 there are few who decide to do
 something about them now. Not
 tomorrow. Not next week. But today.
 The true entrepreneur is a doer.


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319468
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Saving beans to a databse

2009-02-18 Thread Brian Kotek

There are object-based databases out there, but they don't work with CFCs
natively (or I've never seen an adapter that would allow this). There are
ways to serialize a CFC and save it to the database, but this usually opens
up a ton of issues such as, the main two being that it saves the entire
object, including all dependent objects, and that if you change the object
later you have an awful synchronization issue since your serialized objects
are now all invalid; etc.

Basically you'll need to use one of the CFC-based ORM options like Transfer
or Reactor, generate a DAO, or write your own by hand.


On Wed, Feb 18, 2009 at 2:13 AM, David Mineer min...@gmail.com wrote:


 I have a siteoptions bean which holds session variables that are unique to
 each user.  I use roobies cfc bean generator to create a bean which gives
 me
 get and set access to variables which essetially match the form on my
 website that I use to collect the information.

 How can I store this information in the database to persist it between
 visits for my users?

 The obvious answer would be to have a matching table in the database which
 has a corresponding field for each form field.  I could use transfer for
 this and it would work great and I understand that.  But would that be a
 good thing?

 Or is there I way I can take the bean and just save it to the database as
 one object, easily retrievable for the next session.

 I guess now that I think about it, either way I will have to have a db
 table, so there goes that advantage.  But if the bean were to grow or
 change
 The db wouldn't have to if I was able to save the whole object.

 Anyone have any thoughts on these ramblings?

 --
 David Mineer Jr
 -
 The critical ingredient is getting off your
 butt and doing something. It's as simple
 as that. A lot of people have ideas, but
 there are few who decide to do
 something about them now. Not
 tomorrow. Not next week. But today.
 The true entrepreneur is a doer.


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319478
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Saving beans to a databse

2009-02-18 Thread Gerald Guido

I saw this on RIAForge today. It may do what you want.

http://cfobjectcache.riaforge.org/

-- 
Gerald Guido
http://www.myinternetisbroken.com


To invent, you need a good imagination and a pile of junk.
-- Thomas A. Edison


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Saving beans to a databse

2009-02-18 Thread Brian Kotek

Looking at the code, it looks like it is using JSON to serialize the object,
via CFJSON. But I don't see how that's going to work with CFCs, since the
serializer will see it as a structure, and when it is deserialized later,
you'll end up with a structre, not a CFC.

A further quick review of the code gives me some reservations about the
locking strategies employed and the fact that the cache is based soley on a
hardcoded timeout value rather than something like usage metrics.

If you're interested in reviewing a pretty complex caching system, have a
look at how Transfer is doing it. Even if you don't use Transfer, Mark's
created some pretty robust cache machinery.


On Wed, Feb 18, 2009 at 9:17 AM, Gerald Guido gerald.gu...@gmail.comwrote:


 I saw this on RIAForge today. It may do what you want.

 http://cfobjectcache.riaforge.org/

 --
 Gerald Guido
 http://www.myinternetisbroken.com


 To invent, you need a good imagination and a pile of junk.
 -- Thomas A. Edison


 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319483
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Saving beans to a databse

2009-02-17 Thread David Mineer

I have a siteoptions bean which holds session variables that are unique to
each user.  I use roobies cfc bean generator to create a bean which gives me
get and set access to variables which essetially match the form on my
website that I use to collect the information.

How can I store this information in the database to persist it between
visits for my users?

The obvious answer would be to have a matching table in the database which
has a corresponding field for each form field.  I could use transfer for
this and it would work great and I understand that.  But would that be a
good thing?

Or is there I way I can take the bean and just save it to the database as
one object, easily retrievable for the next session.

I guess now that I think about it, either way I will have to have a db
table, so there goes that advantage.  But if the bean were to grow or change
The db wouldn't have to if I was able to save the whole object.

Anyone have any thoughts on these ramblings?

-- 
David Mineer Jr
-
The critical ingredient is getting off your
butt and doing something. It's as simple
as that. A lot of people have ideas, but
there are few who decide to do
something about them now. Not
tomorrow. Not next week. But today.
The true entrepreneur is a doer.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:319463
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4