Grails: Error while applying criteria Query -


i applying criteria query find sum of columns , save result in long format. when there data in table, working fine, in case no match records found, following error thrown:

cannot cast object 'null' class 'null' class 'long'**

my code is:

long referralpoints = referraldetail.createcriteria().get {     eq('referredby', user)     projections {         sum('referralpoints')     } } 

use long instead of long. primitives cannot null.


Comments

Popular posts from this blog

testing - Detect whether test has failed within fixture -

AbotX : How do you create a parallel crawler that stays on and can be added to at run time from new requests -

android - Create single AAR file from multiple modules using Gradle -