Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

HQL Group different tables?

Mauro Mazzucco
Ranch Hand
Posts: 32
Eclipse IDE Java MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Im pretty new to databases, and programming in general, i tried everything but could not come up with a solution, my problem is: I have 2 tables in my database:


in my Cars table i have 3 columns:
*modelID *carName *carsSold

and the Model table has 3 columns:
*modelID *modelName *modelYear

Now my program has a button that says Group by Model, when the user clicks it has to show the information grouped by the Model, like:

Model ID : 1022

Model Name: Audi
Car Name: A3
Year: 2001
Cars sold: 120

Everything is ready, im just lost at the HQL query, i know i have to change something in the mapping to one-to-many or many-to-many but i have do idea where and wich one

Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!