We're updating the issue view to help you get more done. 

Multiple Joins using criteria

Description

I need to do multiple joins between two tables using Hibernate criteria.

I tried doing the following:

Crtieria criteria = session.createCriteria(Cat.class, "cat");

criteria.createAlias("cat.kittens", "first", CriteriaSpecification.LEFT_JOIN)
.add( Restrictions.eq("first.name", "Foo"));

criteria.createAlias("cat.kittens", "second", CriteriaSpecification.LEFT_JOIN)
.add( Restrictions.eq("second.name", "Bar"));

criteria.list();

I get the following: org.hibernate.QueryException: duplicate association path

I tried looking for issues regarding the same and found http://opensource.atlassian.com/projects/hibernate/browse/HB-555.

I am not aware whether we can do multiple joins using criteria now.

Environment

None

Status

Assignee

Unassigned

Reporter

Praveer Gupta

Fix versions

None

Labels

None

backPortable

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

Components

Affects versions

3.3.2

Priority

Major