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

Hibernate 2: Write hql query to join 3 unrelated classes

 
John Landon
Ranch Hand
Posts: 228
  • 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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic