I am new to HQL and have the following table relationships:
Termhas manyDefinitionsDefinitionhas manyDefinitionProductsDefinitionProductshas oneProduct
I want to get the list of Terms that have at least one Definition that has at least one DefinitionProduct that has a specific Product
This is my best attempt (in Grails):
Term.findAll("from Term t, Definition d inner join t.definitions def,
def.definitionProducts dp where ? = some elements (dp.product)",
Product.get(1))
With the above, I get a "def.definitionProducts is not mapped" exception.
From stackoverflow
-
select t from Term t join t.definitions def join def.definitionProducts dp where dp.product=?
Mike Sickler : That seems to return a list of definitionProductsMaurice Perry : select t from Term t join t.definitions def join def.definitionProducts dp where dp.product=?Mike Sickler : Yes! Thanks a lot. In grails, I just had to switch the call from Term.findAll to Term.executeQuery and it worked!
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.