[hibernate-issues] [Hibernate-JIRA] Created: (HSEARCH-368) paging bug when search by interface

DingWeilong (JIRA) noreply at atlassian.com
Wed May 13 23:32:13 EDT 2009


paging bug when search by interface 
------------------------------------

                 Key: HSEARCH-368
                 URL: http://opensource.atlassian.com/projects/hibernate/browse/HSEARCH-368
             Project: Hibernate Search
          Issue Type: Bug
          Components: query
         Environment: 3.2.5ga and other versons, mysql 5, windows xp
            Reporter: DingWeilong
            Priority: Critical


this is the test case:

public interface Resource
{
   ....
}

this interface have 4 realized classes: Service,Solution, Product, System
I build my HQL script and search as follwows:

String hql="from Resource where ... "
Query query = session.createQuery(hql);
query.setFirstResult(firstResult);
query.setMaxResults(maxSize);

But the search result size is ALWAYS ZERO!
 I did know number of the data in my database is not zero, and could be count and get by other client tools like MYSQL Administrator.

I reviewed my code and debug, and found if I commented the two line of paging(setFirstResult and setMaxResults), it works right. 
I track in the source code and find the paging bug when query by superclass/interface:

take 3.2.5GA from example,
 the  method performList (line 146~203)of class org.hibernate.engine.query.HQLQueryPlan,
 is the reason for my problem:
the line 184 
   if ( distinction.add( result ) ) {
continue;
}

you see,
 the method add will return true if distinction don't have the result object, but if do as the former code, no result will be processed but at once do the next loop.
So, none of the results will be returned.
the line 184 SHOULD be 
if (! distinction.add( result ) ) {
and this should be right for that case

Glad to see all your ideas about it. Thanks!






-- 
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