[hibernate-issues] [Hibernate-JIRA] Created: (HHH-2176) DB2 setMaxResults problem in Hibernate 3.1.3

Winter Lau (JIRA) noreply at atlassian.com
Tue Oct 24 23:51:04 EDT 2006


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


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.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira




More information about the hibernate-issues mailing list