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]