[
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2176?page=all ]
Milosz Tylenda updated HHH-2176:
--------------------------------
Attachment: HHH-2176.patch
My patch fixes the problem and has some other advantages over the current code:
- Correctly handles SELECT DISTINCT queries. The current code uses ROWNUMBER()
with an empty OVER() which, according to docs, might return rows in wrong order.
- Handles SELECT * queries.
- Handles SQL comments without looking for SELECT keyword which may produce syntax
errors.
- Avoids looking for ORDER BY clause which may produce syntax errors if OLAP
functions like RANK() are used.
- Code is shorter.
The drawbacks are:
- An additional subquery is used.
- An ORDER OF construct is used which is supported on DB2 UDB 8.1 and later.
7.2 has no support for it and for 8.0 I couldn't find docs (was it an
official release?)
The patch also updates PaginationTest.
DB2 setMaxResults problem in Hibernate 3.1.3
--------------------------------------------
Key: HHH-2176
URL:
http://opensource.atlassian.com/projects/hibernate/browse/HHH-2176
Project: Hibernate3
Type: Bug
Components: core
Versions: 3.1.3
Environment: DB2 any version
Hibernate 3.1.3
JDK 1.5
Reporter: Winter Lau
Priority: Blocker
Attachments: HHH-2176.patch
public static List listHotTags(int count){
Session ssn = getSession();
String sql = "SELECT tag_name,COUNT(*) FROM dlog_tag GROUP BY tag_name ORDER
BY 2 DESC";
SQLQuery query = ssn.createSQLQuery(sql);
query.setMaxResults(count);
List tags = new ArrayList();
List results = query.list();
for(int i=0;results!=null && i
tags.add(((Object[])results.get(i))[0]);
}
return tags;
}
tags.add(((Object[])results.get(i))[0]); this code work fine in other database, but in
DB2 , it return the rownumber, i must change to get the second element of array then it
return the correct data.
--
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