Thanks again, I have begun my own Gang of four book from prints off this
list.

Sean
Barney
Nathan
Ray

Thanks!

Justin

-----Original Message-----
From: Barney Boisvert [mailto:[EMAIL PROTECTED]
Sent: Thursday, October 16, 2003 1:56 PM
To: [EMAIL PROTECTED]
Subject: RE: [CFCDev] Strugling With Persistence


I'd opt for a single PersonPersistor instance (stored in the PersonManager)
that takes a Person object and persists it.  The Person object itself has no
knowledge of persistance.  So my Listener would call
PersonManger.persistPerson(personObj) which would, in turn, defter that to
the PersonPersister.persist(personObj) method to do the actual work.

PersonListener:
method submitPerson(person)
  PersonManager.beginTransaction();
  try {
    PersonManager.persistPerson(person)
    PersonManager.commitTransaction();
  } catch (any e) {
    PersonManager.rollbackTransaction();
  }
}

PersonManager:
method persistPerson(person) {
  getPersonPersister().persistPerson(person);
}

PersonPersister:
method persistPerson(person) {
  CFQUERY
    UPDATE person SET ...
}

> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
> Behalf Of Justin Balog
> Sent: Thursday, October 16, 2003 12:40 PM
> To: '[EMAIL PROTECTED]'
> Subject: [CFCDev] Strugling With Persistence
>
>
>
> I understand the reason to abstract the mechanism of persistence from the
> application.  I think I have a reasonable grasp on that, however, I am not
> quite sure how to do it.  As always, back to my person example.  I don't
> think the person.obj should be able to save itself (Terminiator Theory).
> What I have is a  PersonPersistor.obj.  As for instance data, the
> PersonPersistor.obj has a coouple instance vars including some
> env. infa and
> objectToPersist, which simply stores the personDTO(). Then, anytime I want
> to save something, I create the PersonPersistor and initialize it with the
> personDTO.obj and execute the persistor.persist().
>
> Rough Pseudo Code:
> <event filter person beaner>
>       PersonBeaner construct person object
> </event filter>
> <PersonLIstener>
>       method submitPerson()
>       modelCFC.beginTransaction();
>       try {
>               personPersistor = CreateObjcet('comp',PersonPersistor);
>               Persistor.init(some env. vars like DSN, and
> person.getDTO());
>               Persistor.persist();
>       modelCFC.commitTransaction();
>       } catch (any e) {
>       modelCFC.rollbackTransaction();
>       }
>
> </PersonListener>
>
> What do you think?  Thanks much in advance.
>
> Justin
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email
> to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev'
> in the message of the email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported
> by Mindtool, Corporation (www.mindtool.com).
>
> An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at
www.mail-archive.com/[EMAIL PROTECTED]
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the word 'unsubscribe cfcdev' 
in the message of the email.

CFCDev is run by CFCZone (www.cfczone.org) and supported
by Mindtool, Corporation (www.mindtool.com).

An archive of the CFCDev list is available at www.mail-archive.com/[EMAIL PROTECTED]

Reply via email to