Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes 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:

-Cars
-Model

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

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic