[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423?page=c...
]
Sandeep Tamhankar commented on HHH-1423:
----------------------------------------
I believe I'm running into a different flavor of this issue. Here's some HQL that
didn't quite do what I wanted, but it satisfied most of my needs:
select foo
from Foo foo
left join foo.bar bar1
left join foo.baz baz1
left join foo.bar bar2
left join foo.baz baz2
where ((bar1.name = :param_1 and bar1.some_field = :param_2)
or (baz1.name = :param_1 and baz1.some_field = :param_2))
and ((bar2.name = :param_3 and bar2.some_field = :param_4)
or (baz2.name = :param_3 and baz2.some_field = :param_4))
In this example, foo.bar and foo.baz are collections.
This is a generated query, but it doesn't quite fit the structure I want because
sometimes I want to find objects Foo whose collections bar and baz don't contain
elements with some name. I thought I could get there like this:
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.baz baz1 with baz1.name = :param_1
where bar1.name is null and baz1.name is null;
which means my first query would look like this:
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.baz baz1 with baz1.name = :param_1
left join foo.bar bar2 with bar2.name = :param_3
left join foo.baz baz2 with baz2.name = :param_3
where ((bar1.some_field = :param_2)
or (baz1.some_field = :param_2))
and ((bar2.some_field = :param_4)
or (baz2.some_field = :param_4))
basically, just move the 'name' references in the predicate up to the join clause.
This failed (returned no results). However, when I switched the join order to do all of
the bar's before baz's, it worked. I then tried all baz's before bar's,
and that worked, too.
select foo
from Foo foo
left join foo.bar bar1 with bar1.name = :param_1
left join foo.bar bar2 with bar2.name = :param_3
left join foo.baz baz1 with baz1.name = :param_1
left join foo.baz baz2 with baz2.name = :param_3
where ((bar1.some_field = :param_2)
or (baz1.some_field = :param_2))
and ((bar2.some_field = :param_4)
or (baz2.some_field = :param_4))
Thus, I think the parameter parsing issue that this JIra issue encompasses does apply to
me.
ParameterParser bug - ordinal parameter mismatch
-------------------------------------------------
Key: HHH-1423
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-1423
Project: Hibernate3
Issue Type: Bug
Components: query-hql
Affects Versions: 3.1.2
Environment: Windows XP SP2, JDK 1.5.0_06-b05, Spring 1.2.6, antlr-2.7.6rc1
Reporter: Artur Wronski
Priority: Critical
Attachments: HHH1423Test.java, ParameterParser.2.patch, ParameterParser.3.patch,
ParameterParser.patch, RecognizerBug.java
There is still problem with ParameterParser. The same was in Hibernate 3.1.1
Runnable TestCase in attachment.
--
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....
-
For more information on JIRA, see:
http://www.atlassian.com/software/jira