Issue Details (XML | Word | Printable)

Key: HB-555
Type: Bug Bug
Status: Closed Closed
Resolution: Rejected
Priority: Major Major
Assignee: Gavin King
Reporter: Mike Mosiewicz
Votes: 0
Watchers: 0
Operations

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

Multiple joins using criteria

Created: 16/Dec/03 04:30 AM   Updated: 16/Dec/03 06:15 AM   Resolved: 16/Dec/03 06:15 AM
Component/s: None
Affects Version/s: 2.1
Fix Version/s: None

Time Tracking:
Not Specified

Environment: Hibernate 2.1 final, JDK 1.4.2_02

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


 Description  « Hide

Suppose you want to find a Cat that have kittens named Foo and Bar. You would want to try the following criteria:

Crtieria c = sess.createCriteria(Cat.class);

c.createCriteria("kittens", "first")
.add( Expression.eq("name", "Foo");

c.createCriteria("kittens", "second")
.add( Expression.eq("name", "Bar");

c.list();

You would expect that the following query would create multiple joins. However while it creates multiple WHERE conditions for proper aliases, it doesn't create multiple joins, i.e. it only creates join for the first createCriteria.



Gavin King added a comment - 16/Dec/03 06:15 AM

This is expected functionality, Criteria API does not support multiple joins to same association.