Hi,
i have three tables and 2 JPA model classes:
Unit
------------
id [PK] - Integer
code - String
unitGroups - List<UnitGroup>
UnitGroup
------------
id [PK] - Integer
ugKey - String
units - List<Unit>
units and unitGroups have many-to-many relationship between themselves. briefly i want to write an HQL query to get the output of following sql:
SELECT u.*
FROM units u, unit_groups ug, unit_group_pairs ugp
WHERE ugp.UnitID = u.ID
AND ugp.UnitGroupID = ug.ID
AND ug.UGKey = 'amount' AND u.ID = 10