Subqueries with DetachedCriteria use erroneous alias since version 3.2.6.ga
---------------------------------------------------------------------------
Key: HHH-3534
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-3534
Project: Hibernate Core
Issue Type: Bug
Components: query-criteria
Affects Versions: 3.3.1, 3.3.0.GA, 3.2.6
Environment: Hibernate versions 3.2.6, 3.3.0.GA, 3.3.1.GA.
Databases Hsql 1.8.0.1 and H2 1.1.100 both in in-memory mode.
H2 and HSQL sql dialects.
Sun JDK 1.6.0 (several versions), both Linux and Windows OS.
Reporter: Eirik Maus
When creating a query with a sub-query based on a DetachedCriteria, like in Don Mitchels
comment of 2007-05-15 to issue HHH-952, default alias (using the single-parameter factory
method of DetachedCriteria) for the detached criteria object will be the same as the alias
for the root object of the root criteria ("this_"). This obviously cannot work
as expected.
The error was introduced in Hibernate 3.2.6.ga. Versions 3.2.4 and 3.2.5 does not have
this problem.
A workaround is to specify an alias different than "this_" (and any other
expected query alias) for the DetachedCriteria. As a consequence, the method
DetachedCriteria.forClass(SomeClass.class) cannot be used at all since version 3.2.6.ga.
An alias must be specified (and it must be different from "this_" ).
A solution would make the DetachedCriteria cooperate with its root Criteria to find an
unused alias name. Typically, the query for the main Criteria will already use some
aliases based on the same table in eager-loaded joins, so some form of cooperation or
subquery alias prefix scheme must be used.
--
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