Hi,
I defined a many-to-many relationship. The reference resolution works ok e.g. if I select all elements on one end I can navigate to the other end via the corresponding properties.
However, if I do a named Hibernate SQL query, the join table appears empty???
Has anyone had this problem? way to troubleshoot this?
i.e.
- "select * from Customer" I get all Customers then I can do getOrders().get(0).getProducts() will show all products purchased in Order [i]. This works perfectly.
- Conversely this named query show no results
<query name="Customer.findByCrap">
<![CDATA[SELECT c1
FROM Customer c1
WHERE c1.id IN
(SELECT c2.id
FROM Customer c2
inner join c2.orders o
inner join o.products p
)
]]>
</query>
TIA,
regards,
Giovanni
|