On Jan 25, 2005, at 9:25 PM, Nando wrote:

These are questions, i'm no "expert" ...

If i get the example right, would it make sense to pass WorkerDAO into
CertificationDAO and have a method in WorkerDAO to delete the references?


Or if we would want to follow the textbook (DAO's affect one row only), can
gateways be used to delete multiple rows in a scenario like this? If so,
would it make sense to pass WorkerGateway into CertificationDAO and have a
method in WorkerGateway to delete the references?


If DAO's should only be used for single rows, and gateways should only be
used for selects, is there another "kind" of object that is used for
operations like this on a database that we haven't heard about yet?


What happens if you have Workers, Managers and Contractors in your model,
all can have Certifications that expire? This sort of scenario is common.
How should that be handled?



In Java, I would have them all implement the "Certifiable" interface (no pun intended). The interface would require getCertificateExpirationDate() and expireCertificate() methods. For CF, maybe the Worker, Manager, and Contractor BOs have a reference to a Certificate object, the Certificate object a reference to a...hmm...dunno. Honestly, I'd probably implement the above methods in Certificate object, then "persist," or in this case, delete the Certificate with the CertificateDAO.


Maybe turn this around a bit - what is going to expire the certificate? Some sort of scheduled task? Perhaps provide a method on the CertificateGateway to fetch expired certificate PKs, then loop instantiating an array of certificates, and expire as above.

CascadeManager? Are there objects common in the OO world that specifically
deal with multiple tables or operations like these?


It seems we're in the zone here where OO and relational databases don't play
very well together.



Maybe. In tricky cases like this, I just take my best shot at it and hope for the best. :-)



-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Behalf Of Bill Rawlinson
Sent: Wednesday, January 26, 2005 4:09 AM
To: [email protected]
Subject: Re: [CFCDev] another gateway/dao question


hrm., No sorry I guess I generalized too much. It isn't a situation I am facing specifically - and that is why my contrived example didn't really convey my question I guess.

So I will try a different, but still simple, scenario.

Lets presume we have a Worker and a Certification
a Worker can have a Certification associated with them - however,
sometimes Certifications expire and are deleted as they are no longer
even remotely valid.

So when the certification is deleted - would you, as Chris suggested,
just delete all the references inside the CertificationDAO? Or would
you do this somewhere else?

I run into situations all the time where a object can optionally
reference another object and that referenced object can still be
deleted (so long as the references are deleted as well)

So now, within my object model when I run into this in the future I
just wonder where it would be best practice to put that added query.

My initial feeling has been to have it in the DAO for the referenced
object (Certification, GradeLevel, whatever)- but the "textbook"
definition of DAO I keep seeing is that they only effect one row in
the table.

Should I for consistency sake between how DAOs are expected to behave
pull that reference clearing query out of the referenced object DAO or
- since it is a steadfast data layer rule have it in the DAO?

Hope this helps and thanks again for your feedback
Bill




On Tue, 25 Jan 2005 18:53:09 -0500, Patrick McElhaney <[EMAIL PROTECTED]> wrote:
This may sound oversimplistic, but I would have the application make
sure that that no students are freshmen before deleting the freshman
object.

That may mean looping over all of the freshman objects and promoting
them to sophomores, deleting them, or (ack!) removing their class
affiliation. There may be different strategies for handling different
students. (Promote the A students and drop the rest.) Or it may mean
disabling the delete button on the freshman form.

Of course there plenty of other ways you could handle it. But that's a
decision for your customer to make.

I wouldn't have the gateway try to fix the problem itself.

Patrick

--
Patrick McElhaney
704.560.9117
http://pmcelhaney.blogspot.com
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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]



--
[EMAIL PROTECTED]
http://blog.rawlinson.us

I have 9 gmail invites,want one?
----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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 words '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]



--

***************************************
Chris Dempsey
Director, Information Services
UCSB Graduate Division
Abutebaris modo subjunctivo denuo

----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email
to [EMAIL PROTECTED] with the words '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