Issue Details (XML | Word | Printable)

Key: HB-918
Type: Bug Bug
Status: Closed Closed
Resolution: Rejected
Priority: Major Major
Assignee: Unassigned
Reporter: Luka
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
z - Hibernate 2

Outer join in Criteria

Created: 26/Apr/04 10:38 AM   Updated: 26/Apr/04 07:57 PM   Resolved: 26/Apr/04 07:57 PM
Return to search
Component/s: None
Affects Version/s: None
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Hibernate 2.1 -> 2.1.3

Bug Testcase Reminder (view):
REMINDER: Bug reports should generally be accompanied by a test case
Participants: Gavin King and Luka


 Description  « Hide

When using the criterias and many-to-many association, if you make a new "Sub Criteria", hibernate removes the outer join "" from the where statement:
---------

Table A

---------

ID_A (PK)

---------

---------

Table B

---------

ID_A (FK)
ID_C (FK)

---------

---------

Table C

---------

ID_C (PK)

---------

A<B>C

A and C have a many-to-many relationscip trought B.

If i write:
--------
Criteria criteria = session.createCriteria(A.class);
criteria.setFetchMode("B", FetchMode.EAGER);
List list = criteria.list();
--------

I get in the query where statement the follow:
--------
... where A.ID_A = B.ID_A and B.ID_C = C.ID_C
--------

This work good, but if i make a subCriteria:
--------
Criteria criteria = session.createCriteria(A.class);
criteria.setFetchMode("B", FetchMode.EAGER);

Criteria criteriaB = criteria.createCriteria("B");

List list = criteria.list();
--------

In the query i get:
--------
... where A.ID_A = B.ID_A and B.ID_C = C.ID_C
--------

I've added the "outer-join=true" setting in both "config" and mapping files.



Gavin King added a comment - 26/Apr/04 07:57 PM

This is correct behavior.