]
Adam Skobodzinski commented on HHH-544:
---------------------------------------
I was wondering if there are any plans to fix it. Due to n+1 problem it is really not
feasible to use the constructor form at the moment. Btw. I am using hibernate 3.6.0
select new ... results in n+1 selects
-------------------------------------
Key: HHH-544
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-544
Project: Hibernate Core
Issue Type: Improvement
Components: core
Affects Versions: 3.0.5
Environment: Hibernate 3.0.5, Oracle 8i, JDK 1.4.2
Reporter: Salvatore Insalaco
Priority: Minor
Using collection constructors in select clause of HQL (e.g. new map(...)) generates n + 1
SQL statements (one for primary keys, one for each object).
This is a problem when there're clauses as "distinct" and "order
by":
select distinct o from MyEntity o order by o.description
works, because in the generated SQL all the columns are mapped in the select clause;
but:
select distinct new map (o as result) from MyEntity o order by o.description
doesn't work, because the first line of generated SQL is like:
select distinct id from MyTable order by description
and that's invalid sql (at least in Oracle): description shoud be placed in select
clause.
--
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: