• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Hibernate: query returning data from multiple tables

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have very recently started working with hibernate and things were moving fine when the queries were getting columns from a single Table.
I have a hibernare query which returns data from multiple tables.

It selects data from three tables based on a join condition

1. tbl_site

2. tbl_ste2sitmgr

3. tbl_sitemanager

tbl_ste2sitmgr is basically a link between site and sitemanager, and contains a fk of site and a fk of sitemanager.

a site can have only one manager but a manager can manage many sites.

lets say this is the hibernate query statement



what kind of class should result belong to so that all the retrieved columns be effectively accessed.

I am sorry if this question sounds too lame, but I am a newbie in the hibernate/ORM world. Any help would be deeply appreciated

Thanks


 
Sheriff
Posts: 9709
43
Android Google Web Toolkit Hibernate IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your relationship is a one-to-many relationship. One Manager can be associated with many Sites. You can execute a query from any direction. If you retrieve a Site class object, it will have a Manager class object. If you retrieve a Manager class object, then it will have a list of Site class objects...
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic