DAO for cross-table queries

M

Maciej

Hi,

Imagine the following situation. I've got two tables in my DB: shops
and products. For each of them I've created seperate DAO (Date Access
Object), so I could ask such question: what is the name of shop X or
add new product. By the given table are connected via relation:
shop-sells-product. So there is a need to build yet another DAO for
cross-table queries, isn't?
What is a good, common-used practice for such situations?

Regards,
Maciej
 
M

Manish Pandit

Hi,

You do not need another DAO. This is a bidirectional one to many
relationship, so you can have a collection in both classes. Shops can
contain a Collection or Products, and Product can contain a Collection
of Shops where it is sold.

-cheers,
Manish
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,780
Messages
2,569,614
Members
45,289
Latest member
stfp04

Latest Threads

Top