Bug 236 : Using query language binding a collection parameter to 'in' clause
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.5.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
07/03/2010
Updated 
07/03/2010
Type 
Bug
 
Attachments 
No attachments

if you execute a query that has an 'in' clause using a binding parameter and subsequently run the same query but with a different set with a different number of values then we wrongly reuse the original query.

 
Rob 07 Mar 07:27
test case
public void test() {
        
        ResetBasicData.reset();
        
        List<Object> idList1 = new ArrayList<Object>();
        idList1.add(1);
        
        String oq = "find customer where id in (:idList)";
        Ebean.createQuery(Customer.class, oq)
            .setParameter("idList", idList1)
            .findList();
        
        List<Object> idList2 = new ArrayList<Object>();
        idList2.add(1);
        idList2.add(2);
        
        Ebean.createQuery(Customer.class, oq)
            .setParameter("idList", idList2)
            .findList();
    
        
    }

Rob 07 Mar 07:29
Fixed in HEAD

Fixed in HEAD.

The fix involves taking the size of the collection (and the property name etc) into account when calculating the query plan hash.

woResponse

Upload a file