support createCriteria() for <key-many-to-one>

Description

I have one class Bar with a primary key composed of a 'key-many-to-one' to a class Foo.
I want to find a Bar instance with a Foo id so I have this criteria :

Criteria criteria = session.createCriteria(Bar.class);

criteria.createCriteria("foo").add(Expression.eq("id", new Integer(1)));

Bar bar = (Bar) criteria.uniqueResult();

Then I have this sql statement

select this.ID_FOO as ID_FOO0_, this.text as text0_ from BAR this where x0_.id=1

which fails because x0_ isn't defined.

With an HQL query it works.

Environment

Win2k
SQLServer with jTds driver

Assignee

Unassigned

Reporter

Sebastien Cesbron

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

Priority

Minor
Configure