Teddy,

It sounds like you are suggesting that I create a query or stored
proceedure that does an INNER JOIN on the products and productitems
table, is that correct?

Also, should I place the method in the product gateway or the
productitems gateway?

What are some best practices for working with 1-to-many and
many-to-many relationships between tables in the database? I looked at
the Observer pattern for working with such relationships between
objects (in the book, Head First Design Patterns), but couldn't figure
out how to apply it to tables.

-Aaron

On 12/5/06, Teddy Payne <[EMAIL PROTECTED]> wrote:
> Or you can just create one method in your gateway object to execute a query
> or stored procedure and your are done.
>
> Teddy
>
> On 12/5/06, Aaron Roberson <[EMAIL PROTECTED]> wrote:
> >
> > I am getting a better grasp on this OOP stuff everyday (but it is
> > taking a while) and now I am at the point where I can't figure out how
> > to interact with 1-to-many and many-to-many relationships.
> >
> > Example:
> > I have two tables (product & productitems). The productitems table
> > contains a foreign key field so there is one product to many product
> > items.
> >
> > I need to loop through the productitems where the foreign key matches
> > the productid in the product table. Do I create an method in my
> > gateway with an INNER JOIN query. If so, would that go in the product
> > gateway or the productitems gateway?
> >
> > Also, I am using services to further abstract things. So would I
> > create a new service component to get at the method in my gateway or
> > would I add a method in one of my existing services.
> >
> > Maybe I am completely wrong and all I need to do is add a couple
> > getters and setters in my products bean. I really don't have a clue...
> >
> > Any help would be appreciated!
> >
> > -Aaron
> >
> >
>
> 

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Create robust enterprise, web RIAs.
Upgrade & integrate Adobe Coldfusion MX7 with Flex 2
http://ad.doubleclick.net/clk;56760587;14748456;a?http://www.adobe.com/products/coldfusion/flex2/?sdid=LVNU

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:262987
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to