• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

HQL query related to many-to-many relationship

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hibernate version: 2.1.7c

I'm having a problem in getting the proper HQL for the follwong senario:

I have done the many-to-many relationship mapping. (In this, the ITEM has a set of Orders and The Orders has a set of Items)
ITEM is defined as the inverse end. The records for ITEM_ORDER table gets inserted when calling the session.save(order) and works fine.


Now, how to write the HQL to find out all the Orders objects that contains Item "ITM_01" ? In other words, i need to get all the Orders objects, that has Item "ITM_01" in their Item set.

please help.
 
Shanika Weerapperuma
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
oh, i found it and so impressed to see how simple it is :



 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic