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

Access many to many tables in HQL

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am trying to access users that have a subset of from an interests table. The Interets and Users tables have a many to many relationship using a join table.

The JDO's generated look like this (Simplified):



My HQL code looks like this, I get an error "could not resolve property"

select user from Users as user where user.defInterestses.defInterests.id = 2 or user.defInterestses.defInterests.id = 1




 
Anantha Sharma
Ranch Hand
Posts: 43
Android Hibernate jQuery
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
try



you need to look at the collection mapping as a property & not a collection in the query...
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic