[ http://opensource.atlassian.com/projects/hibernate/browse/HB-417?page=comments#action_23126 ]
Hendrik D commented on HB-417:
------------------------------
Since I'm not authorized to see the TODO list, can anyone tell me if there's some update for this issue? When is it due to be fixed?
I don't actually see this as a 'new feature'. I didn't read any documentation stating that the criteria.createCriteria didn't work for many to one relations. Also, the behaviour is strange: it generates no join statement, but then tries to use the joined table in the where, resulting in invalid SQL. It took me a lot of time to find out what the problem was...
> support createCriteria() for <key-many-to-one>
> ----------------------------------------------
>
> Key: HB-417
> URL: http://opensource.atlassian.com/projects/hibernate/browse/HB-417
> Project: Hibernate2
> Type: New Feature
> Components: core
> Versions: 2.1 beta 4
> Environment: Win2k
> SQLServer with jTds driver
> Reporter: Sebastien Cesbron
> Priority: Minor
> Attachments: testHibernate.zip
>
>
> 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.
--
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.jspa
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira
|