[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2049?page=c...
]
Mattias Jiderhamn commented on HHH-2049:
----------------------------------------
Sure:
select
this_.order_id as order1_0_1_,
orderline1_.order_id as order2_3_,
orderline1_.order_line_id as order1_3_,
orderline1_.order_line_id as order1_1_0_,
orderline1_.order_id as order2_1_0_,
orderline1_.article_id as article3_1_0_
from
t_order this_
left outer join
order_line orderline1_
on this_.order_id=orderline1_.order_id
where
orderline1_.article_id>=?
and orderline1_.article_id<=?
Although the problem isn't really with the SQL - it returns what's expected
(although possibly it would work if it didn't SELECT the order line columns - hmm,
that might be a clue to an alternative solution). The problem is that Hibernate needs to
perform another query to fetch the child collection - since the first select doesn't
return all of them.
It would need to also execute this query:
select
orderlines0_.order_id as order2_1_,
orderlines0_.order_line_id as order1_1_,
orderlines0_.order_line_id as order1_5_0_,
orderlines0_.order_id as order2_5_0_,
orderlines0_.article_id as article3_5_0_
from
order_line orderlines0_
where
orderlines0_.order_id=?
LEFT OUTER JOIN subcriteria filters children
--------------------------------------------
Key: HHH-2049
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2049
Project: Hibernate3
Type: Bug
Components: query-criteria
Versions: 3.1.3, 3.2.0.cr4
Environment: Hibernate 3.1.3/3.2.0rc4, hsqldb 1.8
Reporter: Mattias Jiderhamn
Attachments: SubCriteriaTestCase.zip
When using the Criteria API with LEFT OUTER JOIN to add criterias to the children, i.e.
criteria.createCriteria("children", JoinFragment.LEFT_OUTER_JOIN)
the child collections will only contain those children matching the criteria. (Even when
*not* using any Filters).
The attached testcase (also found here:
http://forum.hibernate.org/viewtopic.php?p=2320786) will explain it in more detail.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
http://opensource.atlassian.com/projects/hibernate/secure/Administrators....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira