Bug 152 : @SqlSelect ... dynamic where and having clauses not getting parsed properly
Priority 
High
Reported Version 
 
Logged By 
Rob
Status 
Fixed
Fixed Version 
2.1.0
Assigned To 
 
Product 
Ebean - core
Duplicate Of 
 
Created 
12/09/2009
Updated 
12/09/2009
Type 
Bug
 
Attachments 
No attachments

So for ...

@SqlSelect(
name="default",
query="select order_id, sum(order_qty*unit_price) as total_amount from o_order_detail group by order_id"
),

... totalAmount if used in having clause should translate to:

sum(order_qty*unit_price)

 
Rob 12 Sep 00:48
example
List<OrderReport> list = 
     Ebean.find(OrderReport.class)
         .having().gt("totalAmount", 20.50)
         .findList();

Rob 12 Sep 00:50
Should generate SQL:
select order_id, sum(order_qty*unit_price) as total_amount 
from o_order_detail 
group by order_id  
having sum(order_qty*unit_price) > ?

Note: Should generate "having sum(order_qty*unit_price)" and instead generates "having total_amount" ... and we can't use the column alias.

woResponse

Upload a file