Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [eclipselink-users] EL building select count() instead of select count(*)

Anuj,

We were finally able to reproduce this, and have a simple solution.
 
Something changed surrounding report queries without a specified expression builder.  The issue only crops up here because the PK of PurchaseFraudJdo is a OneToOneMapping.  

My reproduction is resolved when I change one line...  the top one.
 

        ExpressionBuilder builder = new ExpressionBuilder(); //no class in ExpressionBuilder
        ReadAllQuery readAllQuery = new ReadAllQuery(PurchaseFraudJdo.class); 
        readAllQuery.addArgument("pGoodCode"); 
        readAllQuery.addJoinedAttribute("po"); 
        ...
To 
 
        ExpressionBuilder builder = new ExpressionBuilder(PurchaseFraudJdo.class); //<-- class
        ReadAllQuery readAllQuery = new ReadAllQuery(PurchaseFraudJdo.class); 
        readAllQuery.addArgument("pGoodCode"); 
        readAllQuery.addJoinedAttribute("po"); 
        ...

-----Original Message-----
From: Tom Ware 
Sent: Thursday, November 11, 2010 7:59 AM
To: EclipseLink User Discussions
Subject: Re: [eclipselink-users] EL building select count() instead of
select count(*)


Can you provide details about how PurchaseFraudJdo is mapped?

-Tom

Anuj Lal wrote:
>                 Eclipselink    11.1.1.3.0 (eclipse link  2.0.3-r7973 ) 
> not building addCount sql correctly    
> 
>                 Building select count()…   instead of select count(*)….
> 
>  
> 
>                 Same code wokrs fine with 11.1.1.2.0 (  eclipse link 
> 1.2.1-r7082)
> 
>  
> 
>  
> 
>   
> 
>  
> 
> Expression pendingExp =
> 
>                 builder.get("reviewStatusCode").
> 
>                         
> equal(DatabaseCodes.PURCHASE_FRAUD_REVIEW_STATUS_PENDING_REVIEW).
> 
>                         or(builder.get("reviewStatusCode").
> 
>                                 
> equal(DatabaseCodes.PURCHASE_FRAUD_REVIEW_STATUS_BLOCKED_BY_RULES)).
> 
>                         or(builder.get("reviewStatusCode").
> 
>                                 
> equal(DatabaseCodes.PURCHASE_FRAUD_REVIEW_STATUS_BLOCKED_BY_SCORE)).
> 
>                         
> or(builder.get("reviewStatusCode").equal(DatabaseCodes.PURCHASE_FRAUD_REVIEW_STATUS_FOLLOW_UP));
> 
>  
> 
> // count all purchases pending fraud review
> 
>         ReportQuery rptQuery = new ReportQuery(PurchaseFraudJdo.class, 
> pendingExp);
> 
>         rptQuery.addCount();
> 
>         rptQuery.bindAllParameters();
> 
>         rptQuery.setShouldReturnSingleValue(true);
> 
>         server.registerToplinkQuery(FIND_PENDING_COUNT, rptQuery);
> 
>  
> 
>  
> 
> building a query like this
> 
> SELECT COUNT() FROM PURCHASE_ORDER t0, PURCHASE_FRAUD t1 WHERE 
> (((((t1.REVIEW_STATUS = ?) OR (t1.REVIEW_STATUS = ?)) OR 
> (t1.REVIEW_STATUS = ?)) OR (t1.REVIEW_STATUS = ?)) AND 
> (t0.PURCHASE_ORDER_ID = t1.PURCHASE_ORDER_ID))
> 
>         bind => [P, R, S, F]
> 
>  
> 
>  
> 
> giving parsing expression
> 
>  
> 
> it building COUNT() instead of COUNT(*)
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> eclipselink-users mailing list
> eclipselink-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users


Back to the top