• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Hibernate 2: Write hql query to join 3 unrelated classes

 
Ranch Hand
Posts: 239
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am a newbie and having trouble writing a query to join 3 unrelated classes ClassA, ClassB, ClassC.
Here are the details (and I will show in code below).. ClassA has long attribute that will match the id of ClassB (but the id of ClassB is Long). ClassB has attribute of type ClassC. ClassC has attribute of type string.
Here is the code:


here are the hbm relevant lines:
ClassA hbm:


ClassB hbm:


ClassC hbm:


I want to get all objects of ClassA where ClassA.classBid=ClassB.id and ClassB.classC=ClassC and ClassC.name="abc"

Thanks,
John
 
And then we all jump out and yell "surprise! we got you this tiny ad!"
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic