Results 1 to 2 of 2

Thread: Many to Many relationship on IBatis

  1. #1
    Join Date
    Jan 2008
    Posts
    26

    Unhappy Many to Many relationship on IBatis

    Hi Good People,

    I am stuck in many-to-many relationship problem in IBatis. I have the following scenario:
    Code:
    Table: cutomers (custid, custname) 
    
    Table: Product (prodid, prodname)
    
    Table: Billing (billingid, custid, prodid)
    As you can see third table implementing M:M relationship.

    Now i want to display in the UI like :

    List of products along with total number of customers in each product.

    I have made database query for this problem like :

    Code:
    SELECT   prodid, (select count(*) custid from billing where billing.prodid=prod.prodid) as NO_of_customers,DESCRIPTION  FROM prod
    after that i am unable to understand how should i write this query in sql map files and also how should i retrieve data in the UI?

    Please suggest me if any one has any idea?

    Thanks and Regards,
    Khushwinder

  2. #2
    Join Date
    Jan 2008
    Posts
    26

    Default

    If any one has any idea suggest me.
    I am waiting for your answers...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •