A friendly place for programming greenhorns!
Big Moose Saloon
Register / Login
Win a copy of
OCA Java SE 8 Programmer I Study Guide 1Z0-808
this week in the
Object Relational Mapping
Many to Many relationship Query in hibernate
Joined: Oct 03, 2007
May 11, 2009 22:56:28
Hi Good People,
I am stuck in many-to-many relationship problem in Hibernate. I have the following scenario:
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 :
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 map this query to any object class ?
Please suggest me if any one has any idea?
Thanks and Regards,
I agree. Here's the link:
subject: Many to Many relationship Query in hibernate
how to query this in Spring and Hibernate
Inner join in Hibernate
Data type mismatch need to convert string to a number
Help required with DB pagination
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
| Powered by
Copyright © 1998-2015