Not quite but close..

assuming GetByCategoryID could return multiple entries you would want
have that in a "Gateway"

so you would have

<cfset entries = EntryGateway.GetByCategoryID(categoryID) />

If you wanted to just get a single Entry, say by it's ID then you
would reference the DAO

<cfset entry = EntryDAO.load(entryID) />

if you wanted to get all of the category ids from that freshly loaded
entry you would reference the entry as such:

<cfset categoryIdList = entry.getCategoryIdList() />

where entry is an instance of EntryInstance (or as some might call EntryBean)

So you have an EntryInstance which is everything that defines a single
entry and encapsulates all of the properties you need for a single
Entry.

EntryDAO is responsible for all persistance involved for a single EntryInstance

EntryGateway is responsible for all the manipulation of multiple
EntryInstances (EntryGateway, if returning a collection of
EntryInstance would probably just return the query as opposed to
building an collection of objects of type EntryInstance due to
performance concerns).

I typically name these objects as such:
EntryInstance = Entry
EntryDAO = EntryDAO
EntryGateway  = Entries

Hope this helps and doesn't further muddy the water.

Bill







On 11/23/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> Bill,
>
> Thanks for the explanation. That makes a lot of sense. So then, just to take
> it one step further, if I was going to query for entries, rather than
> update, you might have something like:
>
> // Gets entries for a given category
> EntryDAO.GetByCategoryID( FORM.category_id )
>
> // Gets the category id list for the given entry instance
> EntryInstance.GetCategoryIDList()
>
>
> These are just off the top of my head... any suggestions.
>
> Thanks again,
> Ben Nadel
>
>
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
> Of Bill Rawlinson
> Sent: Wednesday, November 23, 2005 9:07 AM
> To: [email protected]
> Subject: Re: [CFCDev] Updating Join tables
>
> I would pass the category ids into the "EntryDAO" since the entryDAO's
> job is to deal with the persistence of one complete Entry.  The
> category ids are a property of the Entry and thus the EntryDAO should
> save/update/read/delete that data as necessary for that particular
> Entry.
>
> A DAO doesn't necessarilly = access to a single table in the database.
>  A DAO maps to a single entity in your model.  Alot of times your
> entities are equivilent to a row in a table in the database but
> othertimes (alot of times) they span out into different tables just as
> your example does.
>
> Bill
>
>
>
> On 11/23/05, Ben Nadel <[EMAIL PROTECTED]> wrote:
> >
> >
> >
> > So I am trying to get my head around all these new OOP things for
> > ColdFusion. I feel like I have a better understanding of entity beans and
> > how they get updated, but one thing that I have not seen an example of is
> > how join tables get updated.
> >
> >
> >
> > Let's say that I have a blog entry table "entry" and each entry can be
> > "joined" to related categories in the table "category_entry_jn" table.
> Now,
> > when I am updating my entry via a Form, do I pass category IDs to the
> entry
> > bean for updating the join table? Or does it get passed to EntryDAO? What
> > would these look like?
> >
> >
> >
> > EntryInstance.SetCategoryIDs(FORM.listCategoryID) ????
> >
> >
> >
> > Thanks,
> >
> >
> > ben
> >
> > ......................
> >
> > Ben Nadel
> >
> > Web Developer
> >
> > Nylon Technology
> >
> > 6 West 14th Street
> >
> > New York, NY 10011
> >
> > 212.691.1134
> >
> > 212.691.3477 fax
> >
> > www.nylontechnology.com
> > ----------------------------------------------------------
> >  You are subscribed to cfcdev. To unsubscribe, send an email to
> > [email protected] with the words 'unsubscribe cfcdev' as the subject of
> the
> > email.
> >
> >  CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> > (www.cfxhosting.com).
> >
> >  An archive of the CFCDev list is available at
> > www.mail-archive.com/[email protected]
>
>
> --
> [EMAIL PROTECTED]
> http://blog.rawlinson.us
>
> If you want Gmail - just ask.
>
>
> ----------------------------------------------------------
> You are subscribed to cfcdev. To unsubscribe, send an email to
> [email protected] with the words 'unsubscribe cfcdev' as the subject of the
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting
> (www.cfxhosting.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' as the subject of the 
> email.
>
> CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
> (www.cfxhosting.com).
>
> An archive of the CFCDev list is available at 
> www.mail-archive.com/[email protected]
>
>
>


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

If you want Gmail - just ask.


----------------------------------------------------------
You are subscribed to cfcdev. To unsubscribe, send an email to 
[email protected] with the words 'unsubscribe cfcdev' as the subject of the 
email.

CFCDev is run by CFCZone (www.cfczone.org) and supported by CFXHosting 
(www.cfxhosting.com).

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


Reply via email to